using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using PickGold.Charting.ChartTypes;
using PickGold.Charting.Utilities;
using PickGold.Charting.Design;

namespace PickGold.Charting
{
	[SRDescription("DescriptionAttributeAxis_Axis"), DefaultProperty("Enabled"), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
	public class Axis : ChartNamedElement, IChartMapArea
	{
		private AxisArrowStyle _arrowStyle;
		private bool _autoMaximum;
		private bool _autoMinimum;
		private float _aveLabelFontSize;
		private AxisPosition _axisPosition;
		private CustomLabelsCollection _customLabels;
		private FontCache _fontCache;
		private Color _interlacedColor;
		private DateTimeIntervalType _internalIntervalType;
		private IntervalAutoMode _intervalAutoMode;
		private double _intervalOffset;
		private Stack<double> _intervalsStore;
		private bool _isInterlaced;
		private bool _isLabelAutoFit;
		private bool _isLogarithmic;
		private bool _isMarksNextToAxis;
		private LabelAutoFitStyles _labelAutoFitStyle;
		private Color _lineColor;
		private ChartDashStyle _lineDashStyle;
		private int _lineWidth;
		private string _mapAreaAttributes;
		private float _minLabelFontSize;
		private double _originalViewPosition;
		private string _postbackValue;
		private AxisScaleView _scaleView;
		private bool _storeValuesEnabled;
		private ArrayList _stripLineOffsets;
		private StripLinesCollection _stripLines;
		private TextOrientation _textOrientation;
		private string _title;
		private StringAlignment _titleAlignment;
		private Font _titleFont;
		private Color _titleForeColor;
		private RectangleF _titlePosition;
		private string _toolTip;
		private string _url;
		internal bool autoEnabled;
		internal int autoLabelAngle;
		internal Font autoLabelFont;
		internal int autoLabelOffset;
		internal AxisScaleBreakStyle axisScaleBreakStyle;
		internal AxisName axisType;
		internal double crossing;
		internal const float elementSpacing = 1f;
		internal bool enabled;
		internal float[] groupingLabelSizes;
		internal double interval;
		internal double interval3DCorrection;
		internal DateTimeIntervalType intervalOffsetType;
		internal DateTimeIntervalType intervalType;
		internal bool isReversed;
		internal bool isStartedFromZero;
		internal int labelAutoFitMaxFontSize;
		internal int labelAutoFitMinFontSize;
		internal float labelFarOffset;
		internal float labelNearOffset;
		internal float labelSize;
		internal LabelStyle labelStyle;
		internal double logarithmBase;
		internal bool logarithmicConvertedToLinear;
		internal double logarithmicMaximum;
		internal double logarithmicMinimum;
		internal Grid majorGrid;
		internal TickMark majorTickMark;
		internal double margin;
		internal double marginTemp;
		internal double marginView;
		internal float markSize;
		private const float maxAxisElementsSize = 75f;
		private const float maxAxisLabelRow2Size = 45f;
		private const float maxAxisMarkSize = 20f;
		private const float maxAxisTitleSize = 20f;
		internal double maximum;
		internal double maximumFromData;
		internal double minimum;
		internal double minimumFromData;
		internal Grid minorGrid;
		internal TickMark minorTickMark;
		internal int numberOfPointsInAllSeries;
		internal bool offsetTempSet;
		internal Axis oppositeAxis;
		internal bool optimizedGetPosition;
		internal RectangleF paintAreaPosition;
		internal double paintAreaPositionBottom;
		internal double paintAreaPositionRight;
		internal double paintChartAreaSize;
		internal bool paintMode;
		internal double paintRange;
		internal double paintViewMax;
		internal double paintViewMin;
		internal ElementPosition PlotAreaPosition;
		internal int prefferedNumberofIntervals;
		internal bool refreshMinMaxFromData;
		internal bool roundedXValues;
		internal AxisScaleSegmentCollection scaleSegments;
		internal bool scaleSegmentsUsed;
		internal float scrollBarSize;
		internal bool tempAutoMaximum;
		internal bool tempAutoMinimum;
		internal double tempCrossing;
		internal DateTimeIntervalType tempGridIntervalType;
		internal double tempLabelInterval;
		internal DateTimeIntervalType tempLabelIntervalType;
		internal CustomLabelsCollection tempLabels;
		internal double tempMajorGridInterval;
		internal double tempMajorTickMarkInterval;
		internal double tempMaximum;
		internal double tempMinimum;
		internal double tempMinorGridInterval;
		internal double tempMinorTickMarkInterval;
		internal DateTimeIntervalType tempTickMarkIntervalType;
		internal float titleSize;
		internal float totlaGroupingLabelsSize;
		internal float totlaGroupingLabelsSizeAdjustment;
		internal float unRotatedLabelSize;
		internal double valueMultiplier;

		public Axis()
			: base(null, GetName(AxisName.X))
		{
			this._storeValuesEnabled = true;
			this._fontCache = new FontCache();
			this._titleForeColor = Color.Black;
			this._titleAlignment = StringAlignment.Center;
			this._title = "";
			this._lineWidth = 1;
			this._lineDashStyle = ChartDashStyle.Solid;
			this._lineColor = Color.Black;
			this._isLabelAutoFit = true;
			this._isMarksNextToAxis = true;
			this._labelAutoFitStyle = LabelAutoFitStyles.WordWrap | LabelAutoFitStyles.LabelsAngleStep30 | LabelAutoFitStyles.StaggeredLabels | LabelAutoFitStyles.DecreaseFont | LabelAutoFitStyles.IncreaseFont;
			this.autoLabelAngle = -1000;
			this.autoLabelOffset = -1;
			this._aveLabelFontSize = 10f;
			this._minLabelFontSize = 5f;
			this._titlePosition = RectangleF.Empty;
			this.minimumFromData = double.NaN;
			this.maximumFromData = double.NaN;
			this.refreshMinMaxFromData = true;
			this._originalViewPosition = double.NaN;
			this._interlacedColor = Color.Empty;
			this.labelAutoFitMinFontSize = 6;
			this.labelAutoFitMaxFontSize = 10;
			this._toolTip = string.Empty;
			this._url = string.Empty;
			this._mapAreaAttributes = string.Empty;
			this._postbackValue = string.Empty;
			this.margin = 100.0;
			this._stripLineOffsets = new ArrayList();
			this.logarithmBase = 10.0;
			this.isStartedFromZero = true;
			this.autoEnabled = true;
			this.maximum = double.NaN;
			this.crossing = double.NaN;
			this.minimum = double.NaN;
			this.tempMaximum = double.NaN;
			this.tempMinimum = double.NaN;
			this.tempCrossing = double.NaN;
			this.tempAutoMaximum = true;
			this.tempAutoMinimum = true;
			this.tempMajorGridInterval = double.NaN;
			this.tempMajorTickMarkInterval = double.NaN;
			this.tempLabelInterval = double.NaN;
			this.tempGridIntervalType = DateTimeIntervalType.NotSet;
			this.tempTickMarkIntervalType = DateTimeIntervalType.NotSet;
			this.tempLabelIntervalType = DateTimeIntervalType.NotSet;
			this._autoMaximum = true;
			this._autoMinimum = true;
			this.interval3DCorrection = double.NaN;
			this.paintAreaPosition = RectangleF.Empty;
			this.prefferedNumberofIntervals = 5;
			this._intervalsStore = new Stack<double>();
			this.Initialize(AxisName.X);
		}

		public Axis(ChartArea chartArea, AxisName axisTypeName)
			: base(chartArea, GetName(axisTypeName))
		{
			this._storeValuesEnabled = true;
			this._fontCache = new FontCache();
			this._titleForeColor = Color.Black;
			this._titleAlignment = StringAlignment.Center;
			this._title = "";
			this._lineWidth = 1;
			this._lineDashStyle = ChartDashStyle.Solid;
			this._lineColor = Color.Black;
			this._isLabelAutoFit = true;
			this._isMarksNextToAxis = true;
			this._labelAutoFitStyle = LabelAutoFitStyles.WordWrap | LabelAutoFitStyles.LabelsAngleStep30 | LabelAutoFitStyles.StaggeredLabels | LabelAutoFitStyles.DecreaseFont | LabelAutoFitStyles.IncreaseFont;
			this.autoLabelAngle = -1000;
			this.autoLabelOffset = -1;
			this._aveLabelFontSize = 10f;
			this._minLabelFontSize = 5f;
			this._titlePosition = RectangleF.Empty;
			this.minimumFromData = double.NaN;
			this.maximumFromData = double.NaN;
			this.refreshMinMaxFromData = true;
			this._originalViewPosition = double.NaN;
			this._interlacedColor = Color.Empty;
			this.labelAutoFitMinFontSize = 6;
			this.labelAutoFitMaxFontSize = 10;
			this._toolTip = string.Empty;
			this._url = string.Empty;
			this._mapAreaAttributes = string.Empty;
			this._postbackValue = string.Empty;
			this.margin = 100.0;
			this._stripLineOffsets = new ArrayList();
			this.logarithmBase = 10.0;
			this.isStartedFromZero = true;
			this.autoEnabled = true;
			this.maximum = double.NaN;
			this.crossing = double.NaN;
			this.minimum = double.NaN;
			this.tempMaximum = double.NaN;
			this.tempMinimum = double.NaN;
			this.tempCrossing = double.NaN;
			this.tempAutoMaximum = true;
			this.tempAutoMinimum = true;
			this.tempMajorGridInterval = double.NaN;
			this.tempMajorTickMarkInterval = double.NaN;
			this.tempLabelInterval = double.NaN;
			this.tempGridIntervalType = DateTimeIntervalType.NotSet;
			this.tempTickMarkIntervalType = DateTimeIntervalType.NotSet;
			this.tempLabelIntervalType = DateTimeIntervalType.NotSet;
			this._autoMaximum = true;
			this._autoMinimum = true;
			this.interval3DCorrection = double.NaN;
			this.paintAreaPosition = RectangleF.Empty;
			this.prefferedNumberofIntervals = 5;
			this._intervalsStore = new Stack<double>();
			this.Initialize(axisTypeName);
		}

		private bool AddInterlacedStrip()
		{
			bool flag = false;
			if (this.IsInterlaced)
			{
				StripLine item = new StripLine();
				item.interlaced = true;
				item.BorderColor = Color.Empty;
				if (this.MajorGrid.Enabled && (this.MajorGrid.GetInterval() != 0.0))
				{
					flag = true;
					item.Interval = this.MajorGrid.GetInterval() * 2.0;
					item.IntervalType = this.MajorGrid.GetIntervalType();
					item.IntervalOffset = this.MajorGrid.GetIntervalOffset();
					item.IntervalOffsetType = this.MajorGrid.GetIntervalOffsetType();
					item.StripWidth = this.MajorGrid.GetInterval();
					item.StripWidthType = this.MajorGrid.GetIntervalType();
				}
				else if (this.MajorTickMark.Enabled && (this.MajorTickMark.GetInterval() != 0.0))
				{
					flag = true;
					item.Interval = this.MajorTickMark.GetInterval() * 2.0;
					item.IntervalType = this.MajorTickMark.GetIntervalType();
					item.IntervalOffset = this.MajorTickMark.GetIntervalOffset();
					item.IntervalOffsetType = this.MajorTickMark.GetIntervalOffsetType();
					item.StripWidth = this.MajorTickMark.GetInterval();
					item.StripWidthType = this.MajorTickMark.GetIntervalType();
				}
				else if (this.LabelStyle.Enabled && (this.LabelStyle.GetInterval() != 0.0))
				{
					flag = true;
					item.Interval = this.LabelStyle.GetInterval() * 2.0;
					item.IntervalType = this.LabelStyle.GetIntervalType();
					item.IntervalOffset = this.LabelStyle.GetIntervalOffset();
					item.IntervalOffsetType = this.LabelStyle.GetIntervalOffsetType();
					item.StripWidth = this.LabelStyle.GetInterval();
					item.StripWidthType = this.LabelStyle.GetIntervalType();
				}
				if (!flag)
				{
					return flag;
				}
				if (this.InterlacedColor != Color.Empty)
				{
					item.BackColor = this.InterlacedColor;
				}
				else if (this.ChartArea.BackColor == Color.Empty)
				{
					item.BackColor = this.ChartArea.Area3DStyle.Enable3D ? Color.DarkGray : Color.LightGray;
				}
				else if (this.ChartArea.BackColor == Color.Transparent)
				{
					if ((base.Common.Chart.BackColor != Color.Transparent) && (base.Common.Chart.BackColor != Color.Black))
					{
						item.BackColor = ChartGraphics.GetGradientColor(base.Common.Chart.BackColor, Color.Black, 0.2);
					}
					else
					{
						item.BackColor = Color.LightGray;
					}
				}
				else
				{
					item.BackColor = ChartGraphics.GetGradientColor(this.ChartArea.BackColor, Color.Black, 0.2);
				}
				this.StripLines.Insert(0, item);
			}
			return flag;
		}

		private void AdjustIntervalToFitLabels(ChartGraphics chartGraph, bool autoPlotPosition, bool onlyIncreaseInterval)
		{
			if (this.ScaleSegments.Count == 0)
			{
				this.AdjustIntervalToFitLabels(chartGraph, autoPlotPosition, null, onlyIncreaseInterval);
			}
			else
			{
				this.ScaleSegments.AllowOutOfScaleValues = true;
				foreach (AxisScaleSegment segment in this.ScaleSegments)
				{
					this.AdjustIntervalToFitLabels(chartGraph, autoPlotPosition, segment, onlyIncreaseInterval);
				}
				bool removeFirstRow = true;
				int num = 0;
				ArrayList list = new ArrayList();
				ArrayList list2 = new ArrayList();
				foreach (AxisScaleSegment segment2 in this.ScaleSegments)
				{
					segment2.SetTempAxisScaleAndInterval();
					this.FillLabels(removeFirstRow);
					removeFirstRow = false;
					segment2.RestoreAxisScaleAndInterval();
					if ((num < (this.ScaleSegments.Count - 1)) && (this.CustomLabels.Count > 0))
					{
						list.Add(this.CustomLabels[this.CustomLabels.Count - 1]);
						list2.Add(this.CustomLabels.Count - 1);
						this.CustomLabels.RemoveAt(this.CustomLabels.Count - 1);
					}
					num++;
				}
				int num2 = 0;
				int num3 = 0;
				foreach (CustomLabel label in list)
				{
					int index = ((int)list2[num3]) + num2;
					if (num3 < this.CustomLabels.Count)
					{
						this.CustomLabels.Insert(index, label);
					}
					else
					{
						this.CustomLabels.Add(label);
					}
					ArrayList labelPositions = new ArrayList();
					bool flag2 = this.CheckLabelsFit(chartGraph, (this.markSize + this.scrollBarSize) + this.titleSize, autoPlotPosition, true, false, (this.AxisPosition != AxisPosition.Left) && (this.AxisPosition != AxisPosition.Right), (this.AxisPosition == AxisPosition.Left) || (this.AxisPosition == AxisPosition.Right), labelPositions);
					if (flag2)
					{
						for (int i = 0; flag2 && (i < labelPositions.Count); i++)
						{
							RectangleF ef = (RectangleF)labelPositions[i];
							for (int j = i + 1; flag2 && (j < labelPositions.Count); j++)
							{
								RectangleF rect = (RectangleF)labelPositions[j];
								if (ef.IntersectsWith(rect))
								{
									flag2 = false;
								}
							}
						}
					}
					if (!flag2)
					{
						this.CustomLabels.RemoveAt(index);
					}
					else
					{
						num2++;
					}
					num3++;
				}
				this.ScaleSegments.AllowOutOfScaleValues = false;
			}
		}

		private void AdjustIntervalToFitLabels(ChartGraphics chartGraph, bool autoPlotPosition, AxisScaleSegment axisScaleSegment, bool onlyIncreaseInterval)
		{
			if (axisScaleSegment != null)
			{
				if (this.tempLabels != null)
				{
					this.CustomLabels.Clear();
					foreach (CustomLabel label in this.tempLabels)
					{
						this.CustomLabels.Add(label.Clone());
					}
				}
				axisScaleSegment.SetTempAxisScaleAndInterval();
				this.FillLabels(true);
				axisScaleSegment.RestoreAxisScaleAndInterval();
			}
			double naN = double.NaN;
			foreach (Series series in AxisScaleBreakStyle.GetAxisSeries(this))
			{
				if ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2))
				{
					if (ChartHelper.IndexedSeries(series))
					{
						naN = 1.0;
					}
					else if (((series.XValueType == ChartValueType.String) || (series.XValueType == ChartValueType.Int32)) || (((series.XValueType == ChartValueType.UInt32) || (series.XValueType == ChartValueType.UInt64)) || (series.XValueType == ChartValueType.Int64)))
					{
						naN = 1.0;
					}
					continue;
				}
				if (((series.YValueType == ChartValueType.String) || (series.YValueType == ChartValueType.Int32)) || (((series.YValueType == ChartValueType.UInt32) || (series.YValueType == ChartValueType.UInt64)) || (series.YValueType == ChartValueType.Int64)))
				{
					naN = 1.0;
				}
			}
			bool flag = true;
			bool flag2 = true;
			double oldInterval = (axisScaleSegment == null) ? this.labelStyle.GetInterval() : axisScaleSegment.Interval;
			DateTimeIntervalType type = (axisScaleSegment == null) ? this.labelStyle.GetIntervalType() : axisScaleSegment.IntervalType;
			DateTimeIntervalType type2 = type;
			double num3 = oldInterval;
			ArrayList list2 = new ArrayList();
			bool flag3 = false;
			int num4 = 0;
			while (!flag3 && (num4 <= 0x3e8))
			{
				bool flag4 = true;
				bool flag5 = this.CheckLabelsFit(chartGraph, (this.markSize + this.scrollBarSize) + this.titleSize, autoPlotPosition, true, false, (this.AxisPosition != AxisPosition.Left) && (this.AxisPosition != AxisPosition.Right), (this.AxisPosition == AxisPosition.Left) || (this.AxisPosition == AxisPosition.Right), null);
				if (flag)
				{
					flag = false;
					flag2 = flag5;
					if (onlyIncreaseInterval && flag2)
					{
						flag3 = true;
						continue;
					}
				}
				double newInterval = 0.0;
				DateTimeIntervalType number = DateTimeIntervalType.Number;
				if (flag2)
				{
					if (flag5)
					{
						num3 = oldInterval;
						type2 = type;
						list2.Clear();
						foreach (CustomLabel label2 in this.CustomLabels)
						{
							list2.Add(label2);
						}
						number = type;
						newInterval = this.ReduceLabelInterval(oldInterval, naN, ref number);
					}
					else
					{
						newInterval = num3;
						number = type2;
						flag3 = true;
						flag4 = false;
						this.CustomLabels.Clear();
						foreach (CustomLabel label3 in list2)
						{
							this.CustomLabels.Add(label3);
						}
					}
				}
				else if (!flag5 && (this.CustomLabels.Count > 1))
				{
					number = type;
					newInterval = this.IncreaseLabelInterval(oldInterval, ref number);
				}
				else
				{
					flag3 = true;
				}
				if (newInterval != 0.0)
				{
					oldInterval = newInterval;
					type = number;
					if (axisScaleSegment == null)
					{
						this.SetIntervalAndType(newInterval, number);
					}
					else
					{
						axisScaleSegment.Interval = newInterval;
						axisScaleSegment.IntervalType = number;
					}
					if (flag4)
					{
						if (this.tempLabels != null)
						{
							this.CustomLabels.Clear();
							foreach (CustomLabel label4 in this.tempLabels)
							{
								this.CustomLabels.Add(label4.Clone());
							}
						}
						if (axisScaleSegment == null)
						{
							this.FillLabels(true);
						}
						else
						{
							axisScaleSegment.SetTempAxisScaleAndInterval();
							this.FillLabels(true);
							axisScaleSegment.RestoreAxisScaleAndInterval();
						}
					}
				}
				else
				{
					flag3 = true;
				}
				num4++;
			}
		}

		internal void AdjustLabelFontAtSecondPass(ChartGraphics chartGraph, bool autoPlotPosition)
		{
			if (((this.Enabled != AxisEnabled.False) && this.LabelStyle.Enabled) && this.IsVariableLabelCountModeEnabled())
			{
				if (this.autoLabelFont == null)
				{
					this.autoLabelFont = this.LabelStyle.Font;
				}
				if (this.autoLabelAngle < 0)
				{
					this.autoLabelAngle = this.LabelStyle.Angle;
				}
				if (this.autoLabelOffset < 0)
				{
					this.autoLabelOffset = this.LabelStyle.IsStaggered ? 1 : 0;
				}
				if (!this.CheckLabelsFit(chartGraph, (this.markSize + this.scrollBarSize) + this.titleSize, autoPlotPosition, true, true, (this.AxisPosition != AxisPosition.Left) && (this.AxisPosition != AxisPosition.Right), (this.AxisPosition == AxisPosition.Left) || (this.AxisPosition == AxisPosition.Right), null))
				{
					this.AdjustIntervalToFitLabels(chartGraph, autoPlotPosition, true);
				}
			}
			this.totlaGroupingLabelsSizeAdjustment = 0f;
			if ((this.IsLabelAutoFit && (this.LabelAutoFitStyle != LabelAutoFitStyles.None)) && (this.Enabled != AxisEnabled.False))
			{
				bool flag2 = false;
				if (this.autoLabelFont == null)
				{
					this.autoLabelFont = this.LabelStyle.Font;
				}
				float totlaGroupingLabelsSize = this.totlaGroupingLabelsSize;
				while (!flag2)
				{
					flag2 = this.CheckLabelsFit(chartGraph, (this.markSize + this.scrollBarSize) + this.titleSize, autoPlotPosition, true, true);
					if (!flag2)
					{
						if (this.autoLabelFont.SizeInPoints > this._minLabelFontSize)
						{
							if ((this.ChartArea != null) && this.ChartArea.IsSameFontSizeForAllAxes)
							{
								foreach (Axis axis in this.ChartArea.Axes)
								{
									if ((axis.enabled && axis.IsLabelAutoFit) && (axis.autoLabelFont != null))
									{
										axis.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(axis.autoLabelFont.FontFamily, this.autoLabelFont.SizeInPoints - 1f, axis.autoLabelFont.Style, GraphicsUnit.Point);
									}
								}
							}
							else if ((this.LabelAutoFitStyle & LabelAutoFitStyles.DecreaseFont) == LabelAutoFitStyles.DecreaseFont)
							{
								this.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(this.autoLabelFont.FontFamily, this.autoLabelFont.SizeInPoints - 1f, this.autoLabelFont.Style, GraphicsUnit.Point);
							}
							else
							{
								flag2 = true;
							}
						}
						else
						{
							flag2 = true;
						}
					}
				}
				this.totlaGroupingLabelsSizeAdjustment = totlaGroupingLabelsSize - this.totlaGroupingLabelsSize;
			}
		}

		internal double CalcInterval(double diff)
		{
			if (diff == 0.0)
			{
				throw new ArgumentOutOfRangeException("diff", SR.ExceptionAxisScaleIntervalIsZero);
			}
			double y = -1.0;
			double num2 = diff;
			while (num2 > 1.0)
			{
				y++;
				num2 /= 10.0;
				if (y > 1000.0)
				{
					throw new InvalidOperationException(SR.ExceptionAxisScaleMinimumMaximumInvalid);
				}
			}
			num2 = diff;
			if (num2 < 1.0)
			{
				y = 0.0;
			}
			while (num2 < 1.0)
			{
				y--;
				num2 *= 10.0;
				if (y < -1000.0)
				{
					throw new InvalidOperationException(SR.ExceptionAxisScaleMinimumMaximumInvalid);
				}
			}
			double x = this.IsLogarithmic ? this.logarithmBase : 10.0;
			double num4 = diff / Math.Pow(x, y);
			if (num4 < 3.0)
			{
				num4 = 2.0;
			}
			else if (num4 < 7.0)
			{
				num4 = 5.0;
			}
			else
			{
				num4 = 10.0;
			}
			return (num4 * Math.Pow(x, y));
		}

		private double CalcInterval(double min, double max)
		{
			return this.CalcInterval((max - min) / 5.0);
		}

		internal double CalcInterval(double min, double max, bool date, out DateTimeIntervalType type, ChartValueType valuesType)
		{
			if (date)
			{
				DateTime time = DateTime.FromOADate(min);
				TimeSpan span = DateTime.FromOADate(max).Subtract(time);
				double totalMinutes = span.TotalMinutes;
				if ((totalMinutes <= 1.0) && (valuesType != ChartValueType.Date))
				{
					double totalMilliseconds = span.TotalMilliseconds;
					if (totalMilliseconds <= 10.0)
					{
						type = DateTimeIntervalType.Milliseconds;
						return 1.0;
					}
					if (totalMilliseconds <= 50.0)
					{
						type = DateTimeIntervalType.Milliseconds;
						return 4.0;
					}
					if (totalMilliseconds <= 200.0)
					{
						type = DateTimeIntervalType.Milliseconds;
						return 20.0;
					}
					if (totalMilliseconds <= 500.0)
					{
						type = DateTimeIntervalType.Milliseconds;
						return 50.0;
					}
					double totalSeconds = span.TotalSeconds;
					if (totalSeconds <= 7.0)
					{
						type = DateTimeIntervalType.Seconds;
						return 1.0;
					}
					if (totalSeconds <= 15.0)
					{
						type = DateTimeIntervalType.Seconds;
						return 2.0;
					}
					if (totalSeconds <= 30.0)
					{
						type = DateTimeIntervalType.Seconds;
						return 5.0;
					}
					if (totalSeconds <= 60.0)
					{
						type = DateTimeIntervalType.Seconds;
						return 10.0;
					}
				}
				else
				{
					if ((totalMinutes <= 2.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Seconds;
						return 20.0;
					}
					if ((totalMinutes <= 3.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Seconds;
						return 30.0;
					}
					if ((totalMinutes <= 10.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Minutes;
						return 1.0;
					}
					if ((totalMinutes <= 20.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Minutes;
						return 2.0;
					}
					if ((totalMinutes <= 60.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Minutes;
						return 5.0;
					}
					if ((totalMinutes <= 120.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Minutes;
						return 10.0;
					}
					if ((totalMinutes <= 180.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Minutes;
						return 30.0;
					}
					if ((totalMinutes <= 720.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Hours;
						return 1.0;
					}
					if ((totalMinutes <= 1440.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Hours;
						return 4.0;
					}
					if ((totalMinutes <= 2880.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Hours;
						return 6.0;
					}
					if ((totalMinutes <= 4320.0) && (valuesType != ChartValueType.Date))
					{
						type = DateTimeIntervalType.Hours;
						return 12.0;
					}
					if (totalMinutes <= 14400.0)
					{
						type = DateTimeIntervalType.Days;
						return 1.0;
					}
					if (totalMinutes <= 28800.0)
					{
						type = DateTimeIntervalType.Days;
						return 2.0;
					}
					if (totalMinutes <= 43200.0)
					{
						type = DateTimeIntervalType.Days;
						return 3.0;
					}
					if (totalMinutes <= 87840.0)
					{
						type = DateTimeIntervalType.Weeks;
						return 1.0;
					}
					if (totalMinutes <= 219600.0)
					{
						type = DateTimeIntervalType.Weeks;
						return 2.0;
					}
					if (totalMinutes <= 527040.0)
					{
						type = DateTimeIntervalType.Months;
						return 1.0;
					}
					if (totalMinutes <= 1054080.0)
					{
						type = DateTimeIntervalType.Months;
						return 3.0;
					}
					if (totalMinutes <= 2108160.0)
					{
						type = DateTimeIntervalType.Months;
						return 6.0;
					}
					if (totalMinutes >= 2108160.0)
					{
						type = DateTimeIntervalType.Years;
						return this.CalcYearInterval(((totalMinutes / 60.0) / 24.0) / 365.0);
					}
				}
			}
			type = DateTimeIntervalType.Number;
			return this.CalcInterval(min, max);
		}

		private double CalcYearInterval(double years)
		{
			if (years <= 1.0)
			{
				throw new ArgumentOutOfRangeException("years", SR.ExceptionAxisScaleIntervalIsLessThen1Year);
			}
			if (years < 5.0)
			{
				return 1.0;
			}
			if (years < 10.0)
			{
				return 2.0;
			}
			return Math.Floor((double)(years / 5.0));
		}

		internal bool CheckCircularLabelsFit(ChartGraphics graph, ArrayList axisList, CircularAxisLabelsStyle labelsStyle, RectangleF plotAreaRectAbs, RectangleF areaRectAbs, float labelsSizeEstimate)
		{
			PointF absolutePoint = graph.GetAbsolutePoint(this.ChartArea.circularCenter);
			float y = graph.GetAbsolutePoint(new PointF(0f, this.markSize + 1f)).Y;
			RectangleF empty = RectangleF.Empty;
			float naN = float.NaN;
			foreach (CircularChartAreaAxis axis in axisList)
			{
				SizeF ef2 = graph.MeasureString(axis.Title.Replace(@"\n", "\n"), this.autoLabelFont);
				if ((labelsStyle == CircularAxisLabelsStyle.Circular) || (labelsStyle == CircularAxisLabelsStyle.Radial))
				{
					if (labelsStyle == CircularAxisLabelsStyle.Radial)
					{
						float width = ef2.Width;
						ef2.Width = ef2.Height;
						ef2.Height = width;
					}
					float num4 = absolutePoint.Y - plotAreaRectAbs.Y;
					num4 -= labelsSizeEstimate;
					num4 += y;
					float num5 = (float)((Math.Atan((double)((ef2.Width / 2f) / num4)) * 180.0) / 3.1415926535897931);
					float num6 = axis.AxisPosition + num5;
					num5 = axis.AxisPosition - num5;
					if (!float.IsNaN(naN) && (naN > num5))
					{
						return false;
					}
					naN = num6 - 1f;
					PointF tf2 = new PointF(absolutePoint.X, plotAreaRectAbs.Y);
					tf2.Y += labelsSizeEstimate;
					tf2.Y -= ef2.Height;
					tf2.Y -= y;
					PointF[] pts = new PointF[] { tf2 };
					Matrix matrix = new Matrix();
					matrix.RotateAt(axis.AxisPosition, absolutePoint);
					matrix.TransformPoints(pts);
					if (!areaRectAbs.Contains(pts[0]))
					{
						return false;
					}
					continue;
				}
				if (labelsStyle == CircularAxisLabelsStyle.Horizontal)
				{
					float axisPosition = axis.AxisPosition;
					if (axisPosition > 180f)
					{
						axisPosition -= 180f;
					}
					PointF[] tfArray2 = new PointF[] { new PointF(absolutePoint.X, plotAreaRectAbs.Y) };
					tfArray2[0].Y += labelsSizeEstimate;
					tfArray2[0].Y -= y;
					Matrix matrix2 = new Matrix();
					matrix2.RotateAt(axisPosition, absolutePoint);
					matrix2.TransformPoints(tfArray2);
					RectangleF rect = new RectangleF(tfArray2[0].X, tfArray2[0].Y - (ef2.Height / 2f), ef2.Width, ef2.Height);
					if (axisPosition < 5f)
					{
						rect.X = tfArray2[0].X - (ef2.Width / 2f);
						rect.Y = tfArray2[0].Y - ef2.Height;
					}
					if (axisPosition > 175f)
					{
						rect.X = tfArray2[0].X - (ef2.Width / 2f);
						rect.Y = tfArray2[0].Y;
					}
					rect.Inflate(0f, -rect.Height * 0.15f);
					if (!areaRectAbs.Contains(rect))
					{
						return false;
					}
					if (!empty.IsEmpty && rect.IntersectsWith(empty))
					{
						return false;
					}
					empty = rect;
				}
			}
			return true;
		}

		private bool CheckLabelsFit(ChartGraphics chartGraph, float otherElementsSize, bool autoPlotPosition, bool checkLabelsFirstRowOnly, bool secondPass)
		{
			return this.CheckLabelsFit(chartGraph, otherElementsSize, autoPlotPosition, checkLabelsFirstRowOnly, secondPass, true, true, null);
		}

		private bool CheckLabelsFit(ChartGraphics chartGraph, float otherElementsSize, bool autoPlotPosition, bool checkLabelsFirstRowOnly, bool secondPass, bool checkWidth, bool checkHeight, ArrayList labelPositions)
		{
			if (labelPositions != null)
				labelPositions.Clear();
			using (var format = new StringFormat())
			{
				var height = 0f;
				var empty = RectangleF.Empty;
				format.FormatFlags |= StringFormatFlags.LineLimit;
				format.Trimming = StringTrimming.EllipsisCharacter;
				if (!autoPlotPosition)
				{
					if (this.GetIsMarksNextToAxis())
					{
						if (this.AxisPosition == AxisPosition.Top)
							height = ((float)this.GetAxisPosition()) - this.ChartArea.Position.Y;
						else if (this.AxisPosition == AxisPosition.Bottom)
							height = this.ChartArea.Position.Bottom - ((float)this.GetAxisPosition());
						if (this.AxisPosition == AxisPosition.Left)
							height = ((float)this.GetAxisPosition()) - this.ChartArea.Position.X;
						else if (this.AxisPosition == AxisPosition.Right)
							height = this.ChartArea.Position.Right - ((float)this.GetAxisPosition());
					}
					else
					{
						if (this.AxisPosition == AxisPosition.Top)
							height = this.PlotAreaPosition.Y - this.ChartArea.Position.Y;
						else if (this.AxisPosition == AxisPosition.Bottom)
							height = this.ChartArea.Position.Bottom - this.PlotAreaPosition.Bottom;
						if (this.AxisPosition == AxisPosition.Left)
							height = this.PlotAreaPosition.X - this.ChartArea.Position.X;
						else if (this.AxisPosition == AxisPosition.Right)
							height = this.ChartArea.Position.Right - this.PlotAreaPosition.Right;
					}
					height *= 2f;
				}
				else if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
					height = this.ChartArea.Position.Height;
				else
					height = this.ChartArea.Position.Width;
				this.totlaGroupingLabelsSize = 0f;
				int groupLabelLevelCount = this.GetGroupLabelLevelCount();
				if (groupLabelLevelCount > 0)
				{
					var flag = true;
					this.groupingLabelSizes = new float[groupLabelLevelCount];
					for (int i = 1; i <= groupLabelLevelCount; i++)
					{
						this.groupingLabelSizes[i - 1] = 0f;
						foreach (var label in this.CustomLabels)
						{
							if (label.RowIndex == 0)
							{
								var num4 = (label.FromPosition + label.ToPosition) / 2.0;
								if ((num4 < this.ViewMinimum) || (num4 > this.ViewMaximum))
									continue;
							}
							if (label.RowIndex == i)
							{
								var linearPosition = this.GetLinearPosition(label.FromPosition);
								var num6 = this.GetLinearPosition(label.ToPosition);
								if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
								{
									empty.Height = ((height / 100f) * 45f) / ((float)groupLabelLevelCount);
									empty.X = (float)Math.Min(linearPosition, num6);
									empty.Width = ((float)Math.Max(linearPosition, num6)) - empty.X;
								}
								else
								{
									empty.Width = ((height / 100f) * 45f) / ((float)groupLabelLevelCount);
									empty.Y = (float)Math.Min(linearPosition, num6);
									empty.Height = ((float)Math.Max(linearPosition, num6)) - empty.Y;
								}
								var ef2 = chartGraph.MeasureStringRel(label.Text.Replace(@"\n", "\n"), this.autoLabelFont);
								if (label.Image.Length > 0)
								{
									var size = new SizeF();
									if (base.Common.ImageLoader.GetAdjustedImageSize(label.Image, chartGraph.Graphics, ref size))
									{
										var relativeSize = chartGraph.GetRelativeSize(size);
										ef2.Width += relativeSize.Width;
										ef2.Height = Math.Max(ef2.Height, relativeSize.Height);
									}
								}
								if (label.LabelMark == LabelMarkStyle.Box)
								{
									var ef5 = chartGraph.GetRelativeSize(new SizeF(4f, 4f));
									ef2.Width += ef5.Width;
									ef2.Height += ef5.Height;
								}
								if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
								{
									this.groupingLabelSizes[i - 1] = Math.Max(this.groupingLabelSizes[i - 1], ef2.Height);
								}
								else
								{
									ef2.Width = chartGraph.GetAbsoluteSize(new SizeF(ef2.Height, ef2.Height)).Height;
									ef2.Width = chartGraph.GetRelativeSize(new SizeF(ef2.Width, ef2.Width)).Width;
									this.groupingLabelSizes[i - 1] = Math.Max(this.groupingLabelSizes[i - 1], ef2.Width);
								}
								if ((Math.Round((double)ef2.Width) >= Math.Round((double)empty.Width)) && checkWidth)
								{
									flag = false;
								}
								if ((Math.Round((double)ef2.Height) >= Math.Round((double)empty.Height)) && checkHeight)
								{
									flag = false;
								}
							}
						}
					}
					this.totlaGroupingLabelsSize = this.GetGroupLablesToatalSize();
					if (!flag && !checkLabelsFirstRowOnly)
					{
						return false;
					}
				}
				float autoLabelAngle = this.autoLabelAngle;
				int num8 = 0;
				foreach (CustomLabel label2 in this.CustomLabels)
				{
					if (label2.RowIndex == 0)
					{
						double num9 = (label2.FromPosition + label2.ToPosition) / 2.0;
						if ((num9 < this.ViewMinimum) || (num9 > this.ViewMaximum))
						{
							continue;
						}
					}
					if (label2.RowIndex != 0)
					{
						continue;
					}
					if (labelPositions != null)
					{
						this.ScaleSegments.EnforceSegment(this.ScaleSegments.FindScaleSegmentForAxisValue((label2.FromPosition + label2.ToPosition) / 2.0));
					}
					double num10 = this.GetLinearPosition(label2.FromPosition);
					double num11 = this.GetLinearPosition(label2.ToPosition);
					if (labelPositions != null)
					{
						this.ScaleSegments.EnforceSegment(null);
					}
					empty.X = this.PlotAreaPosition.X;
					empty.Y = (float)Math.Min(num10, num11);
					empty.Height = ((float)Math.Max(num10, num11)) - empty.Y;
					float num12 = 75f;
					if ((75f - this.totlaGroupingLabelsSize) > 55f)
						num12 = 55f + this.totlaGroupingLabelsSize;
					if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
						empty.Width = (height / 100f) * (((num12 - this.totlaGroupingLabelsSize) - otherElementsSize) - 1f);
					else
						empty.Width = (height / 100f) * (((num12 - this.totlaGroupingLabelsSize) - otherElementsSize) - 1f);
					if (this.autoLabelOffset == 1)
					{
						empty.Y -= empty.Height / 2f;
						empty.Height *= 2f;
						empty.Width /= 2f;
					}
					if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
					{
						float num13 = empty.Height;
						empty.Height = empty.Width;
						empty.Width = num13;
						if (autoLabelAngle != 0f)
						{
							format.FormatFlags |= StringFormatFlags.DirectionVertical;
						}
					}
					else
					{
						if (Math.Abs(autoLabelAngle) == 90f)
						{
							autoLabelAngle = 0f;
							format.FormatFlags |= StringFormatFlags.DirectionVertical;
						}
					}
					SizeF ef6 = chartGraph.MeasureStringRel(label2.Text.Replace(@"\n", "\n") + "W", this.autoLabelFont, secondPass ? empty.Size : this.ChartArea.Position.ToRectangleF().Size, format);
					if ((label2.Text.Length > 0) && ((ef6.Width == 0f) || (ef6.Height == 0f)))
					{
						format.FormatFlags ^= StringFormatFlags.LineLimit;
						ef6 = chartGraph.MeasureStringRel(label2.Text.Replace(@"\n", "\n"), this.autoLabelFont, secondPass ? empty.Size : this.ChartArea.Position.ToRectangleF().Size, format);
						format.FormatFlags |= StringFormatFlags.LineLimit;
					}
					if (label2.Image.Length > 0)
					{
						SizeF ef7 = new SizeF();
						if (base.Common.ImageLoader.GetAdjustedImageSize(label2.Image, chartGraph.Graphics, ref ef7))
						{
							SizeF ef8 = chartGraph.GetRelativeSize(ef7);
							if ((format.FormatFlags & StringFormatFlags.DirectionVertical) == StringFormatFlags.DirectionVertical)
							{
								ef6.Height += ef8.Height;
								ef6.Width = Math.Max(ef6.Width, ef8.Width);
							}
							else
							{
								ef6.Width += ef8.Width;
								ef6.Height = Math.Max(ef6.Height, ef8.Height);
							}
						}
					}
					if (label2.LabelMark == LabelMarkStyle.Box)
					{
						var ef9 = chartGraph.GetRelativeSize(new SizeF(4f, 4f));
						ef6.Width += ef9.Width;
						ef6.Height += ef9.Height;
					}
					var width = ef6.Width;
					var num15 = ef6.Height;
					if (autoLabelAngle != 0f)
					{
						empty.Width *= 0.97f;
						if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
						{
							width = ((float)Math.Cos((Math.Abs(autoLabelAngle) / 180f) * 3.1415926535897931)) * ef6.Height;
							width += ((float)Math.Sin((Math.Abs(autoLabelAngle) / 180f) * 3.1415926535897931)) * ef6.Width;
							num15 = ((float)Math.Sin((Math.Abs(autoLabelAngle) / 180f) * 3.1415926535897931)) * ef6.Height;
							num15 += ((float)Math.Cos((Math.Abs(autoLabelAngle) / 180f) * 3.1415926535897931)) * ef6.Width;
						}
						else
						{
							width = ((float)Math.Cos((Math.Abs(autoLabelAngle) / 180f) * 3.1415926535897931)) * ef6.Width;
							width += ((float)Math.Sin((Math.Abs(autoLabelAngle) / 180f) * 3.1415926535897931)) * ef6.Height;
							num15 = ((float)Math.Sin((Math.Abs(autoLabelAngle) / 180f) * 3.1415926535897931)) * ef6.Width;
							num15 += ((float)Math.Cos((Math.Abs(autoLabelAngle) / 180f) * 3.1415926535897931)) * ef6.Height;
						}
					}
					if (labelPositions != null)
					{
						var ef10 = empty;
						if (autoLabelAngle == 0f || autoLabelAngle == 90f || autoLabelAngle == -90f)
						{
							if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
							{
								ef10.X = (ef10.X + (ef10.Width / 2f)) - (width / 2f);
								ef10.Width = width;
							}
							else
							{
								ef10.Y = (ef10.Y + (ef10.Height / 2f)) - (num15 / 2f);
								ef10.Height = num15;
							}
						}
						labelPositions.Add(ef10);
					}
					if (autoLabelAngle == 0f)
					{
						if ((width >= empty.Width) && checkWidth)
							return false;

						if ((num15 >= empty.Height) && checkHeight)
							return false;
					}
					else if (autoLabelAngle == 90f || autoLabelAngle == -90f)
					{
						if ((width >= empty.Width) && checkWidth)
							return false;

						if ((num15 >= empty.Height) && checkHeight)
							return false;

						goto Label_0C8E;
					}
					if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
					{
						if ((width >= (empty.Width * 2f)) && checkWidth)
							return false;

						if ((num15 >= (empty.Height * 2f)) && checkHeight)
							return false;
					}
					else
					{
						if ((width >= (empty.Width * 2f)) && checkWidth)
							return false;

						if ((num15 >= (empty.Height * 2f)) && checkHeight)
							return false;
					}
				Label_0C8E:
					num8++;
				}
			}
			return true;
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (this._fontCache != null)
				{
					this._fontCache.Dispose();
					this._fontCache = null;
				}
				if (this.labelStyle != null)
				{
					this.labelStyle.Dispose();
					this.labelStyle = null;
				}
				if (this._stripLines != null)
				{
					this._stripLines.Dispose();
					this._stripLines = null;
				}
				if (this._customLabels != null)
				{
					this._customLabels.Dispose();
					this._customLabels = null;
				}
				if (this.tempLabels != null)
				{
					this.tempLabels.Dispose();
					this.tempLabels = null;
				}
			}
			base.Dispose(disposing);
		}

		private void Draw3DAxisLine(ChartGraphics graph, PointF point1, PointF point2, bool horizontal, bool backElements)
		{
			bool isAxisOnAreaEdge = this.IsAxisOnAreaEdge;
			bool onEdge = isAxisOnAreaEdge;
			if ((onEdge && (this.MajorTickMark.TickMarkStyle == TickMarkStyle.AcrossAxis)) || (((this.MajorTickMark.TickMarkStyle == TickMarkStyle.InsideArea) || (this.MinorTickMark.TickMarkStyle == TickMarkStyle.AcrossAxis)) || (this.MinorTickMark.TickMarkStyle == TickMarkStyle.InsideArea)))
			{
				onEdge = false;
			}
			if ((horizontal && (point1.X > point2.X)) || (!horizontal && (point1.Y > point2.Y)))
			{
				PointF tf = new PointF(point1.X, point1.Y);
				point1.X = point2.X;
				point1.Y = point2.Y;
				point2 = tf;
			}
			float z = this.ChartArea.IsMainSceneWallOnFront() ? this.ChartArea.areaSceneDepth : 0f;
			SurfaceNames surfaceName = this.ChartArea.IsMainSceneWallOnFront() ? SurfaceNames.Front : SurfaceNames.Back;
			if (this.ChartArea.ShouldDrawOnSurface(SurfaceNames.Back, backElements, onEdge))
			{
				graph.StartHotRegion(this._url, this._toolTip);
				graph.Draw3DLine(this.ChartArea.matrix3D, this._lineColor, this._lineWidth, this._lineDashStyle, new Point3D(point1.X, point1.Y, z), new Point3D(point2.X, point2.Y, z), base.Common, this, ChartElementType.Nothing);
				graph.EndHotRegion();
			}
			z = this.ChartArea.IsMainSceneWallOnFront() ? 0f : this.ChartArea.areaSceneDepth;
			surfaceName = this.ChartArea.IsMainSceneWallOnFront() ? SurfaceNames.Back : SurfaceNames.Front;
			if (this.ChartArea.ShouldDrawOnSurface(surfaceName, backElements, onEdge) && ((!isAxisOnAreaEdge || ((this.AxisPosition == AxisPosition.Bottom) && this.ChartArea.IsBottomSceneWallVisible())) || (((this.AxisPosition == AxisPosition.Left) && this.ChartArea.IsSideSceneWallOnLeft()) || ((this.AxisPosition == AxisPosition.Right) && !this.ChartArea.IsSideSceneWallOnLeft()))))
			{
				graph.StartHotRegion(this._url, this._toolTip);
				graph.Draw3DLine(this.ChartArea.matrix3D, this._lineColor, this._lineWidth, this._lineDashStyle, new Point3D(point1.X, point1.Y, z), new Point3D(point2.X, point2.Y, z), base.Common, this, ChartElementType.Nothing);
				graph.EndHotRegion();
			}
			var names2 = ((this.AxisPosition == AxisPosition.Left) || (this.AxisPosition == AxisPosition.Right)) ? SurfaceNames.Top : SurfaceNames.Left;
			if (this.ChartArea.ShouldDrawOnSurface(names2, backElements, onEdge) && ((!isAxisOnAreaEdge || ((this.AxisPosition == AxisPosition.Bottom) && (this.ChartArea.IsBottomSceneWallVisible() || this.ChartArea.IsSideSceneWallOnLeft()))) || ((((this.AxisPosition == AxisPosition.Left) && this.ChartArea.IsSideSceneWallOnLeft()) || ((this.AxisPosition == AxisPosition.Right) && !this.ChartArea.IsSideSceneWallOnLeft())) || ((this.AxisPosition == AxisPosition.Top) && this.ChartArea.IsSideSceneWallOnLeft()))))
			{
				graph.StartHotRegion(this._url, this._toolTip);
				graph.Draw3DLine(this.ChartArea.matrix3D, this._lineColor, this._lineWidth, this._lineDashStyle, new Point3D(point1.X, point1.Y, this.ChartArea.areaSceneDepth), new Point3D(point1.X, point1.Y, 0f), base.Common, this, ChartElementType.Nothing);
				graph.EndHotRegion();
			}
			names2 = ((this.AxisPosition == AxisPosition.Left) || (this.AxisPosition == AxisPosition.Right)) ? SurfaceNames.Bottom : SurfaceNames.Right;
			if (this.ChartArea.ShouldDrawOnSurface(names2, backElements, onEdge) && (((!isAxisOnAreaEdge || ((this.AxisPosition == AxisPosition.Bottom) && (this.ChartArea.IsBottomSceneWallVisible() || !this.ChartArea.IsSideSceneWallOnLeft()))) || ((this.AxisPosition == AxisPosition.Left) && (this.ChartArea.IsSideSceneWallOnLeft() || this.ChartArea.IsBottomSceneWallVisible()))) || (((this.AxisPosition == AxisPosition.Right) && (!this.ChartArea.IsSideSceneWallOnLeft() || this.ChartArea.IsBottomSceneWallVisible())) || ((this.AxisPosition == AxisPosition.Top) && !this.ChartArea.IsSideSceneWallOnLeft()))))
			{
				graph.StartHotRegion(this._url, this._toolTip);
				graph.Draw3DLine(this.ChartArea.matrix3D, this._lineColor, this._lineWidth, this._lineDashStyle, new Point3D(point2.X, point2.Y, this.ChartArea.areaSceneDepth), new Point3D(point2.X, point2.Y, 0f), base.Common, this, ChartElementType.Nothing);
				graph.EndHotRegion();
			}
		}

		private void DrawAxis3DTitle(ChartGraphics graph)
		{
			if (this.enabled)
			{
				string title = this.Title;
				PointF empty = PointF.Empty;
				int angle = 0;
				using (StringFormat format = new StringFormat())
				{
					format.Alignment = this.TitleAlignment;
					format.Trimming = StringTrimming.EllipsisCharacter;
					format.FormatFlags |= StringFormatFlags.LineLimit;
					SizeF size = graph.MeasureString(title.Replace(@"\n", "\n"), this.TitleFont, new SizeF(10000f, 10000f), format, this.GetTextOrientation());
					SizeF relativeSize = SizeF.Empty;
					if (format.Alignment != StringAlignment.Center)
					{
						relativeSize = size;
						if (this.IsTextVertical)
						{
							var height = relativeSize.Height;
							relativeSize.Height = relativeSize.Width;
							relativeSize.Width = height;
						}
						relativeSize = graph.GetRelativeSize(relativeSize);
						if (this.ChartArea.ReverseSeriesOrder)
						{
							if (format.Alignment == StringAlignment.Near)
								format.Alignment = StringAlignment.Far;
							else
								format.Alignment = StringAlignment.Near;
						}
					}
					if (this.GetTextOrientation() == TextOrientation.Rotated90)
						angle = 90;
					else if (this.GetTextOrientation() == TextOrientation.Rotated270)
						angle = -90;
					if (this.AxisPosition == AxisPosition.Left)
					{
						empty = new PointF(this.ChartArea.PlotAreaPosition.X, this.ChartArea.PlotAreaPosition.Y + (this.ChartArea.PlotAreaPosition.Height / 2f));
						if (format.Alignment == StringAlignment.Near)
						{
							empty.Y = this.ChartArea.PlotAreaPosition.Bottom - (relativeSize.Height / 2f);
						}
						else if (format.Alignment == StringAlignment.Far)
						{
							empty.Y = this.ChartArea.PlotAreaPosition.Y + (relativeSize.Height / 2f);
						}
					}
					else if (this.AxisPosition == AxisPosition.Right)
					{
						empty = new PointF(this.ChartArea.PlotAreaPosition.Right, this.ChartArea.PlotAreaPosition.Y + (this.ChartArea.PlotAreaPosition.Height / 2f));
						if (format.Alignment == StringAlignment.Near)
							empty.Y = this.ChartArea.PlotAreaPosition.Bottom - (relativeSize.Height / 2f);
						else if (format.Alignment == StringAlignment.Far)
							empty.Y = this.ChartArea.PlotAreaPosition.Y + (relativeSize.Height / 2f);
					}
					else if (this.AxisPosition == AxisPosition.Top)
					{
						empty = new PointF(this.ChartArea.PlotAreaPosition.X + (this.ChartArea.PlotAreaPosition.Width / 2f), this.ChartArea.PlotAreaPosition.Y);
						if (format.Alignment == StringAlignment.Near)
							empty.X = this.ChartArea.PlotAreaPosition.X + (relativeSize.Width / 2f);
						else if (format.Alignment == StringAlignment.Far)
							empty.X = this.ChartArea.PlotAreaPosition.Right - (relativeSize.Width / 2f);
					}
					else if (this.AxisPosition == AxisPosition.Bottom)
					{
						empty = new PointF(this.ChartArea.PlotAreaPosition.X + (this.ChartArea.PlotAreaPosition.Width / 2f), this.ChartArea.PlotAreaPosition.Bottom);
						if (format.Alignment == StringAlignment.Near)
							empty.X = this.ChartArea.PlotAreaPosition.X + (relativeSize.Width / 2f);
						else if (format.Alignment == StringAlignment.Far)
							empty.X = this.ChartArea.PlotAreaPosition.Right - (relativeSize.Width / 2f);
					}
					var num4 = 0f;
					var axisOnEdge = false;
					var marksZPosition = this.GetMarksZPosition(out axisOnEdge);
					Point3D[] points = null;
					if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
					{
						points = new Point3D[] { new Point3D(empty.X, empty.Y, marksZPosition), new Point3D(empty.X - 20f, empty.Y, marksZPosition) };
						this.ChartArea.matrix3D.TransformPoints(points);
						empty = points[0].PointF;
						points[0].PointF = graph.GetAbsolutePoint(points[0].PointF);
						points[1].PointF = graph.GetAbsolutePoint(points[1].PointF);
						num4 = (float)Math.Atan((double)((points[1].Y - points[0].Y) / (points[1].X - points[0].X)));
					}
					else
					{
						points = new Point3D[] { new Point3D(empty.X, empty.Y, marksZPosition), new Point3D(empty.X, empty.Y - 20f, marksZPosition) };
						this.ChartArea.matrix3D.TransformPoints(points);
						empty = points[0].PointF;
						points[0].PointF = graph.GetAbsolutePoint(points[0].PointF);
						points[1].PointF = graph.GetAbsolutePoint(points[1].PointF);
						if (points[1].Y != points[0].Y)
							num4 = -((float)Math.Atan((double)((points[1].X - points[0].X) / (points[1].Y - points[0].Y))));
					}
					angle += (int)Math.Round((double)((num4 * 180f) / 3.141593f));
					var num5 = this.labelSize + this.markSize + this.titleSize / 2f;
					var num6 = 0f;
					var num7 = 0f;
					if (this.AxisPosition == AxisPosition.Left)
					{
						num6 = (float)(num5 * Math.Cos((double)num4));
						empty.X -= num6;
					}
					else if (this.AxisPosition == AxisPosition.Right)
					{
						num6 = (float)(num5 * Math.Cos((double)num4));
						empty.X += num6;
					}
					else if (this.AxisPosition == AxisPosition.Top)
					{
						num7 = (float)(num5 * Math.Cos((double)num4));
						num6 = (float)(num5 * Math.Sin((double)num4));
						empty.Y -= num7;
						if (num7 > 0f)
							empty.X += num6;
						else
							empty.X -= num6;
					}
					else if (this.AxisPosition == AxisPosition.Bottom)
					{
						num7 = (float)(num5 * Math.Cos((double)num4));
						num6 = (float)(num5 * Math.Sin((double)num4));
						empty.Y += num7;
						if (num7 > 0f)
							empty.X -= num6;
						else
							empty.X += num6;
					}
					format.LineAlignment = StringAlignment.Center;
					format.Alignment = StringAlignment.Center;
					using (var brush = new SolidBrush(this.TitleForeColor))
						graph.DrawStringRel(title.Replace(@"\n", "\n"), this.TitleFont, brush, empty, format, angle, this.GetTextOrientation());
					if (base.Common.ProcessModeRegions)
					{
						using (var path = graph.GetTranformedTextRectPath(empty, size, angle))
							base.Common.HotRegionsList.AddHotRegion(path, false, ChartElementType.AxisTitle, this);
					}
				}
			}
		}

		internal void DrawAxisLine(ChartGraphics graph, bool backElements)
		{
			var top = ArrowOrientation.Top;
			var empty = PointF.Empty;
			var tf2 = PointF.Empty;
			switch (this.AxisPosition)
			{
				case AxisPosition.Left:
					empty.X = (float)this.GetAxisPosition();
					empty.Y = this.PlotAreaPosition.Bottom;
					tf2.X = (float)this.GetAxisPosition();
					tf2.Y = this.PlotAreaPosition.Y;
					if (!this.isReversed)
					{
						top = ArrowOrientation.Top;
						break;
					}
					top = ArrowOrientation.Bottom;
					break;

				case AxisPosition.Right:
					empty.X = (float)this.GetAxisPosition();
					empty.Y = this.PlotAreaPosition.Bottom;
					tf2.X = (float)this.GetAxisPosition();
					tf2.Y = this.PlotAreaPosition.Y;
					if (!this.isReversed)
					{
						top = ArrowOrientation.Top;
						break;
					}
					top = ArrowOrientation.Bottom;
					break;

				case AxisPosition.Top:
					empty.X = this.PlotAreaPosition.X;
					empty.Y = (float)this.GetAxisPosition();
					tf2.X = this.PlotAreaPosition.Right;
					tf2.Y = (float)this.GetAxisPosition();
					if (!this.isReversed)
					{
						top = ArrowOrientation.Right;
						break;
					}
					top = ArrowOrientation.Left;
					break;

				case AxisPosition.Bottom:
					empty.X = this.PlotAreaPosition.X;
					empty.Y = (float)this.GetAxisPosition();
					tf2.X = this.PlotAreaPosition.Right;
					tf2.Y = (float)this.GetAxisPosition();
					if (!this.isReversed)
					{
						top = ArrowOrientation.Right;
						break;
					}
					top = ArrowOrientation.Left;
					break;
			}
			if (this.ChartArea.chartAreaIsCurcular)
				empty.Y = this.PlotAreaPosition.Y + (this.PlotAreaPosition.Height / 2f);
			if (base.Common.ProcessModePaint)
			{
				if (this.ChartArea.Area3DStyle.Enable3D && !this.ChartArea.chartAreaIsCurcular)
				{
					this.Draw3DAxisLine(graph, empty, tf2, (this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom), backElements);
				}
				else
				{
					Axis axisX;
					PointF tf3;
					graph.StartHotRegion(this._url, this._toolTip);
					graph.DrawLineRel(this._lineColor, this._lineWidth, this._lineDashStyle, empty, tf2);
					graph.EndHotRegion();
					switch (top)
					{
						case ArrowOrientation.Left:
							axisX = this.ChartArea.AxisX;
							break;

						case ArrowOrientation.Right:
							axisX = this.ChartArea.AxisX2;
							break;

						case ArrowOrientation.Top:
							axisX = this.ChartArea.AxisY2;
							break;

						case ArrowOrientation.Bottom:
							axisX = this.ChartArea.AxisY;
							break;

						default:
							axisX = this.ChartArea.AxisX;
							break;
					}
					if (this.isReversed)
					{
						tf3 = empty;
					}
					else
					{
						tf3 = tf2;
					}
					graph.DrawArrowRel(tf3, top, this._arrowStyle, this._lineColor, this._lineWidth, this._lineDashStyle, (double)axisX.majorTickMark.Size, (double)this._lineWidth);
				}
			}
		}

		private void DrawAxisLineHotRegion(ChartGraphics graph)
		{
			using (var path = new GraphicsPath())
			{
				var empty = PointF.Empty;
				var tf2 = PointF.Empty;
				float axisPosition = (float)this.GetAxisPosition();
				switch (this.AxisPosition)
				{
					case AxisPosition.Left:
						empty.X = axisPosition - (this.labelSize + this.markSize);
						empty.Y = this.PlotAreaPosition.Y;
						tf2.X = axisPosition;
						tf2.Y = this.PlotAreaPosition.Bottom;
						break;

					case AxisPosition.Right:
						empty.X = axisPosition;
						empty.Y = this.PlotAreaPosition.Y;
						tf2.X = (axisPosition + this.labelSize) + this.markSize;
						tf2.Y = this.PlotAreaPosition.Bottom;
						break;

					case AxisPosition.Top:
						empty.X = this.PlotAreaPosition.X;
						empty.Y = axisPosition - (this.labelSize + this.markSize);
						tf2.X = this.PlotAreaPosition.Right;
						tf2.Y = axisPosition;
						break;

					case AxisPosition.Bottom:
						empty.X = this.PlotAreaPosition.X;
						empty.Y = axisPosition;
						tf2.X = this.PlotAreaPosition.Right;
						tf2.Y = (axisPosition + this.labelSize) + this.markSize;
						break;
				}
				if (this.ChartArea.chartAreaIsCurcular)
					tf2.Y = this.PlotAreaPosition.Y + (this.PlotAreaPosition.Height / 2f);
				var ef = new RectangleF(empty.X, empty.Y, tf2.X - empty.X, tf2.Y - empty.Y);
				var relativeSize = graph.GetRelativeSize(new SizeF(3f, 3f));
				if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
					ef.Inflate(2f, relativeSize.Height);
				else
					ef.Inflate(relativeSize.Width, 2f);
				var points = new PointF[] { new PointF(ef.Left, ef.Top), new PointF(ef.Right, ef.Top), new PointF(ef.Right, ef.Bottom), new PointF(ef.Left, ef.Bottom) };
				if (this.ChartArea.Area3DStyle.Enable3D && !this.ChartArea.chartAreaIsCurcular)
				{
					var axisOnEdge = false;
					var marksZPosition = this.GetMarksZPosition(out axisOnEdge);
					var pointdArray = new Point3D[points.Length];
					for (int j = 0; j < points.Length; j++)
						pointdArray[j] = new Point3D(points[j].X, points[j].Y, marksZPosition);
					this.ChartArea.matrix3D.TransformPoints(pointdArray);
					for (int k = 0; k < pointdArray.Length; k++)
						points[k] = pointdArray[k].PointF;
				}
				for (int i = 0; i < points.Length; i++)
					points[i] = graph.GetAbsolutePoint(points[i]);
				path.AddPolygon(points);
				base.Common.HotRegionsList.AddHotRegion(graph, path, false, this._toolTip, this._url, this._mapAreaAttributes, this.PostBackValue, this, ChartElementType.Axis);
			}
		}

		private void DrawAxisLineHotRegion(ChartGraphics graph, bool backElements)
		{
			if (base.Common.ProcessModeRegions && ((backElements || !this.ChartArea.Area3DStyle.Enable3D) || this.ChartArea.chartAreaIsCurcular))
				this.DrawAxisLineHotRegion(graph);
		}

		private void DrawAxisTitle(ChartGraphics graph)
		{
			if (this.enabled && (this.Title.Length > 0))
			{
				Matrix matrix = null;
				if (this.ChartArea.Area3DStyle.Enable3D && !this.ChartArea.chartAreaIsCurcular)
				{
					this.DrawAxis3DTitle(graph);
				}
				else
				{
					var title = this.Title;
					var axisPosition = (float)this.GetAxisPosition();
					if (this.AxisPosition == AxisPosition.Bottom)
					{
						if (!this.GetIsMarksNextToAxis())
							axisPosition = this.ChartArea.PlotAreaPosition.Bottom;
						axisPosition = this.ChartArea.PlotAreaPosition.Bottom - axisPosition;
					}
					else if (this.AxisPosition == AxisPosition.Top)
					{
						if (!this.GetIsMarksNextToAxis())
							axisPosition = this.ChartArea.PlotAreaPosition.Y;
						axisPosition -= this.ChartArea.PlotAreaPosition.Y;
					}
					else if (this.AxisPosition == AxisPosition.Right)
					{
						if (!this.GetIsMarksNextToAxis())
							axisPosition = this.ChartArea.PlotAreaPosition.Right;
						axisPosition = this.ChartArea.PlotAreaPosition.Right - axisPosition;
					}
					else if (this.AxisPosition == AxisPosition.Left)
					{
						if (!this.GetIsMarksNextToAxis())
							axisPosition = this.ChartArea.PlotAreaPosition.X;
						axisPosition -= this.ChartArea.PlotAreaPosition.X;
					}
					var num2 = this.markSize + this.labelSize;
					num2 -= axisPosition;
					if (num2 < 0f)
						num2 = 0f;
					using (var format = new StringFormat())
					{
						format.Alignment = this.TitleAlignment;
						format.Trimming = StringTrimming.EllipsisCharacter;
						format.FormatFlags |= StringFormatFlags.FitBlackBox;
						this._titlePosition = this.ChartArea.PlotAreaPosition.ToRectangleF();
						var width = this.titleSize - 1f;
						if (this.AxisPosition == AxisPosition.Left)
						{
							this._titlePosition.X = (this.ChartArea.PlotAreaPosition.X - width) - num2;
							this._titlePosition.Y = this.ChartArea.PlotAreaPosition.Y;
							if (!this.IsTextVertical)
							{
								var ef = new SizeF(width, this.ChartArea.PlotAreaPosition.Height);
								this._titlePosition.Width = ef.Width;
								this._titlePosition.Height = ef.Height;
								format.Alignment = StringAlignment.Center;
								if (this.TitleAlignment == StringAlignment.Far)
								{
									format.LineAlignment = StringAlignment.Near;
								}
								else if (this.TitleAlignment == StringAlignment.Near)
								{
									format.LineAlignment = StringAlignment.Far;
								}
								else
								{
									format.LineAlignment = StringAlignment.Center;
								}
							}
							else
							{
								var absoluteSize = graph.GetAbsoluteSize(new SizeF(width, this.ChartArea.PlotAreaPosition.Height));
								absoluteSize = graph.GetRelativeSize(new SizeF(absoluteSize.Height, absoluteSize.Width));
								this._titlePosition.Width = absoluteSize.Width;
								this._titlePosition.Height = absoluteSize.Height;
								this._titlePosition.Y += (this.ChartArea.PlotAreaPosition.Height / 2f) - (this._titlePosition.Height / 2f);
								this._titlePosition.X += (this.titleSize / 2f) - (this._titlePosition.Width / 2f);
								matrix = this.SetRotationTransformation(graph, this._titlePosition);
								format.LineAlignment = StringAlignment.Center;
							}
						}
						else if (this.AxisPosition == AxisPosition.Right)
						{
							this._titlePosition.X = this.ChartArea.PlotAreaPosition.Right + num2;
							this._titlePosition.Y = this.ChartArea.PlotAreaPosition.Y;
							if (!this.IsTextVertical)
							{
								var ef3 = new SizeF(width, this.ChartArea.PlotAreaPosition.Height);
								this._titlePosition.Width = ef3.Width;
								this._titlePosition.Height = ef3.Height;
								format.Alignment = StringAlignment.Center;
								if (this.TitleAlignment == StringAlignment.Far)
									format.LineAlignment = StringAlignment.Near;
								else if (this.TitleAlignment == StringAlignment.Near)
									format.LineAlignment = StringAlignment.Far;
								else
									format.LineAlignment = StringAlignment.Center;
							}
							else
							{
								var relativeSize = graph.GetAbsoluteSize(new SizeF(width, this.ChartArea.PlotAreaPosition.Height));
								relativeSize = graph.GetRelativeSize(new SizeF(relativeSize.Height, relativeSize.Width));
								this._titlePosition.Width = relativeSize.Width;
								this._titlePosition.Height = relativeSize.Height;
								this._titlePosition.Y += (this.ChartArea.PlotAreaPosition.Height / 2f) - (this._titlePosition.Height / 2f);
								this._titlePosition.X += (this.titleSize / 2f) - (this._titlePosition.Width / 2f);
								matrix = this.SetRotationTransformation(graph, this._titlePosition);
								format.LineAlignment = StringAlignment.Center;
							}
						}
						else if (this.AxisPosition == AxisPosition.Top)
						{
							this._titlePosition.Y = (this.ChartArea.PlotAreaPosition.Y - width) - num2;
							this._titlePosition.Height = width;
							this._titlePosition.X = this.ChartArea.PlotAreaPosition.X;
							this._titlePosition.Width = this.ChartArea.PlotAreaPosition.Width;
							if (this.IsTextVertical)
								matrix = this.SetRotationTransformation(graph, this._titlePosition);
							format.LineAlignment = StringAlignment.Center;
						}
						else if (this.AxisPosition == AxisPosition.Bottom)
						{
							this._titlePosition.Y = this.ChartArea.PlotAreaPosition.Bottom + num2;
							this._titlePosition.Height = width;
							this._titlePosition.X = this.ChartArea.PlotAreaPosition.X;
							this._titlePosition.Width = this.ChartArea.PlotAreaPosition.Width;
							if (this.IsTextVertical)
								matrix = this.SetRotationTransformation(graph, this._titlePosition);
							format.LineAlignment = StringAlignment.Center;
						}
						using (var brush = new SolidBrush(this.TitleForeColor))
							graph.DrawStringRel(title.Replace(@"\n", "\n"), this.TitleFont, brush, this._titlePosition, format, this.GetTextOrientation());
					}
					if (base.Common.ProcessModeRegions)
					{
						var absoluteRectangle = graph.GetAbsoluteRectangle(this._titlePosition);
						var pts = new PointF[] { new PointF(absoluteRectangle.X, absoluteRectangle.Y), new PointF(absoluteRectangle.Right, absoluteRectangle.Bottom) };
						graph.Transform.TransformPoints(pts);
						absoluteRectangle = new RectangleF(pts[0].X, pts[0].Y, pts[1].X - pts[0].X, pts[1].Y - pts[0].Y);
						if (absoluteRectangle.Width < 0f)
						{
							absoluteRectangle.Width = Math.Abs(absoluteRectangle.Width);
							absoluteRectangle.X -= absoluteRectangle.Width;
						}
						if (absoluteRectangle.Height < 0f)
						{
							absoluteRectangle.Height = Math.Abs(absoluteRectangle.Height);
							absoluteRectangle.Y -= absoluteRectangle.Height;
						}
						base.Common.HotRegionsList.AddHotRegion(absoluteRectangle, this, ChartElementType.AxisTitle, false, false);
					}
					if (matrix != null)
						graph.Transform = matrix;
				}
			}
		}

		internal void DrawCircularLine(object obj, ChartGraphics graph, Color color, int width, ChartDashStyle style, float position)
		{
			var rectangle = this.ChartArea.PlotAreaPosition.ToRectangleF();
			rectangle = graph.GetAbsoluteRectangle(rectangle);
			if (rectangle.Width != rectangle.Height)
			{
				if (rectangle.Width > rectangle.Height)
				{
					rectangle.X += (rectangle.Width - rectangle.Height) / 2f;
					rectangle.Width = rectangle.Height;
				}
				else
				{
					rectangle.Y += (rectangle.Height - rectangle.Width) / 2f;
					rectangle.Height = rectangle.Width;
				}
			}
			var num = graph.GetAbsolutePoint(new PointF(position, position)).Y - rectangle.Top;
			rectangle.Inflate(-num, -num);
			var pen = new Pen(color, (float)width);
			pen.DashStyle = graph.GetPenStyle(style);
			if (this.ChartArea.CircularUsePolygons)
				graph.DrawCircleAbs(pen, null, rectangle, this.ChartArea.CircularSectorsNumber, false);
			else
				graph.DrawEllipse(pen, rectangle);
			if ((base.Common.ProcessModeRegions && (rectangle.Width >= 1f)) && (rectangle.Height > 1f))
			{
				GraphicsPath polygonCirclePath = null;
				try
				{
					if (this.ChartArea.CircularUsePolygons)
					{
						polygonCirclePath = graph.GetPolygonCirclePath(rectangle, this.ChartArea.CircularSectorsNumber);
					}
					else
					{
						polygonCirclePath = new GraphicsPath();
						polygonCirclePath.AddEllipse(rectangle);
					}
					pen.Width += 2f;
					polygonCirclePath.Widen(pen);
					base.Common.HotRegionsList.AddHotRegion(polygonCirclePath, false, ChartElementType.Gridlines, obj);
				}
				catch (OutOfMemoryException)
				{
				}
				catch (ArgumentException)
				{
				}
				finally
				{
					polygonCirclePath.Dispose();
				}
			}
		}

		internal void DrawRadialLine(object obj, ChartGraphics graph, Color color, int width, ChartDashStyle style, double position)
		{
			RectangleF rectangle = this.ChartArea.PlotAreaPosition.ToRectangleF();
			rectangle = graph.GetAbsoluteRectangle(rectangle);
			if (rectangle.Width != rectangle.Height)
			{
				if (rectangle.Width > rectangle.Height)
				{
					rectangle.X += (rectangle.Width - rectangle.Height) / 2f;
					rectangle.Width = rectangle.Height;
				}
				else
				{
					rectangle.Y += (rectangle.Height - rectangle.Width) / 2f;
					rectangle.Height = rectangle.Width;
				}
			}
			float angle = this.ChartArea.CircularPositionToAngle(position);
			Region clip = null;
			if (this.ChartArea.CircularUsePolygons)
			{
				clip = graph.Clip;
				graph.Clip = new Region(graph.GetPolygonCirclePath(rectangle, this.ChartArea.CircularSectorsNumber));
			}
			PointF absolutePoint = graph.GetAbsolutePoint(this.ChartArea.circularCenter);
			Matrix transform = graph.Transform;
			Matrix matrix = transform.Clone();
			matrix.RotateAt(angle, absolutePoint);
			graph.Transform = matrix;
			PointF secondPoint = new PointF(rectangle.X + (rectangle.Width / 2f), rectangle.Y);
			graph.DrawLineAbs(color, width, style, absolutePoint, secondPoint);
			if (base.Common.ProcessModeRegions)
			{
				using (GraphicsPath path = new GraphicsPath())
				{
					path.AddLine(absolutePoint, secondPoint);
					path.Transform(matrix);
					try
					{
						using (Pen pen = new Pen(Color.Black, (float)(width + 2)))
						{
							path.Widen(pen);
							base.Common.HotRegionsList.AddHotRegion(path, false, ChartElementType.Gridlines, obj);
						}
					}
					catch (OutOfMemoryException)
					{
					}
					catch (ArgumentException)
					{
					}
				}
			}
			graph.Transform = transform;
			matrix.Dispose();
			if (this.ChartArea.CircularUsePolygons)
			{
				graph.Clip = clip;
			}
		}

		internal void EstimateAxis()
		{
			double num;
			if (!double.IsNaN(this.ScaleView.Size) && double.IsNaN(this.ScaleView.Position))
			{
				this.ScaleView.Position = this.Minimum;
			}
			if (!double.IsNaN(this._scaleView.Position) && !double.IsNaN(this._scaleView.Size))
			{
				double viewMaximum = this.ViewMaximum;
				double viewMinimum = this.ViewMinimum;
				if (this._isLogarithmic)
				{
					viewMaximum = Math.Pow(this.logarithmBase, viewMaximum);
					viewMinimum = Math.Pow(this.logarithmBase, viewMinimum);
				}
				else
				{
					this.EstimateAxis(ref this.minimum, ref this.maximum, this._autoMaximum, this._autoMinimum);
				}
				num = this.EstimateAxis(ref viewMinimum, ref viewMaximum, true, true);
			}
			else
			{
				num = this.EstimateAxis(ref this.minimum, ref this.maximum, this._autoMaximum, this._autoMinimum);
			}
			if (num <= 0.0)
				throw new InvalidOperationException(SR.ExceptionAxisScaleAutoIntervalInvalid);

			if (this.ChartArea.SeriesIntegerType(this.axisType, string.Empty))
			{
				num = Math.Round(num);
				if (num == 0.0)
					num = 1.0;
				this.minimum = Math.Floor(this.minimum);
			}
			this.SetInterval = num;
		}

		internal double EstimateAxis(ref double minimumValue, ref double maximumValue, bool autoMaximum, bool autoMinimum)
		{
			double num;
			if (maximumValue < minimumValue)
			{
				if (!base.Common.ChartPicture.SuppressExceptions)
					throw new InvalidOperationException(SR.ExceptionAxisScaleMinimumValueIsGreaterThenMaximumDataPoint);

				var num2 = maximumValue;
				maximumValue = minimumValue;
				minimumValue = num2;
			}
			var dateTimeType = this.GetDateTimeType();
			if (this._isLogarithmic)
				num = this.EstimateLogarithmicAxis(ref minimumValue, ref maximumValue, this.crossing, autoMaximum, autoMinimum);
			else if (dateTimeType != ChartValueType.Auto)
				num = this.EstimateDateAxis(ref minimumValue, ref maximumValue, autoMaximum, autoMinimum, dateTimeType);
			else
				num = this.EstimateNumberAxis(ref minimumValue, ref maximumValue, this.IsStartedFromZero, this.prefferedNumberofIntervals, autoMaximum, autoMinimum);
			if (num <= 0.0)
				throw new InvalidOperationException(SR.ExceptionAxisScaleAutoIntervalInvalid);

			this.SetInterval = num;
			return num;
		}

		private double EstimateDateAxis(ref double minimumValue, ref double maximumValue, bool autoMaximum, bool autoMinimum, ChartValueType valuesType)
		{
			var min = minimumValue;
			var max = maximumValue;
			var interval = this.CalcInterval(min, max, true, out this._internalIntervalType, valuesType);
			if ((!double.IsNaN(this.interval3DCorrection) && this.ChartArea.Area3DStyle.Enable3D) && !this.ChartArea.chartAreaIsCurcular)
			{
				interval = Math.Floor((double)(interval / this.interval3DCorrection));
				this.interval3DCorrection = double.NaN;
			}
			var num4 = this.GetNumOfUnits(min, max, this._internalIntervalType);
			if ((this.axisType == AxisName.Y) || (this.axisType == AxisName.Y2))
			{
				if (autoMinimum && (minimumValue > ChartHelper.GetIntervalSize(min, interval, this._internalIntervalType)))
				{
					minimumValue += ChartHelper.GetIntervalSize(min, (-(interval / 2.0) * this.margin) / 100.0, this._internalIntervalType, null, 0.0, DateTimeIntervalType.Number, false, false);
					minimumValue = ChartHelper.AlignIntervalStart(minimumValue, (interval * this.margin) / 100.0, this._internalIntervalType);
				}
				if ((autoMaximum && (max > 0.0)) && (this.margin != 0.0))
					maximumValue = minimumValue + ChartHelper.GetIntervalSize(minimumValue, (((Math.Floor((double)(((((double)num4) / interval) / this.margin) * 100.0)) + 2.0) * interval) * this.margin) / 100.0, this._internalIntervalType);
			}
			this.InternalIntervalType = this._internalIntervalType;
			return interval;
		}

		private double EstimateLogarithmicAxis(ref double minimumValue, ref double maximumValue, double crossingValue, bool autoMaximum, bool autoMinimum)
		{
			if (!this.logarithmicConvertedToLinear)
			{
				this.logarithmicMinimum = this.minimum;
				this.logarithmicMaximum = this.maximum;
			}
			this.margin = 100.0;
			if (((base.Common != null) && (base.Common.Chart != null)) && base.Common.Chart.ChartPicture.SuppressExceptions)
			{
				if (minimumValue <= 0.0)
				{
					minimumValue = 1.0;
				}
				if (maximumValue <= 0.0)
				{
					maximumValue = 1.0;
				}
				if ((crossingValue <= 0.0) && (crossingValue != double.MinValue))
				{
					crossingValue = 1.0;
				}
			}
			if (((minimumValue <= 0.0) || (maximumValue <= 0.0)) || (crossingValue <= 0.0))
			{
				if (minimumValue <= 0.0)
				{
					throw new ArgumentOutOfRangeException("minimumValue", SR.ExceptionAxisScaleLogarithmicNegativeValues);
				}
				if (maximumValue <= 0.0)
				{
					throw new ArgumentOutOfRangeException("maximumValue", SR.ExceptionAxisScaleLogarithmicNegativeValues);
				}
			}
			crossingValue = Math.Log(crossingValue, this.logarithmBase);
			minimumValue = Math.Log(minimumValue, this.logarithmBase);
			maximumValue = Math.Log(maximumValue, this.logarithmBase);
			this.logarithmicConvertedToLinear = true;
			double d = (maximumValue - minimumValue) / 5.0;
			double inter = Math.Floor(d);
			if (inter == 0.0)
			{
				inter = 1.0;
			}
			if (autoMinimum && autoMaximum)
			{
				this.RoundedValues(inter, this.IsStartedFromZero, autoMaximum, autoMinimum, ref minimumValue, ref maximumValue);
			}
			if (this.ChartArea.hundredPercent)
			{
				if (autoMinimum && (minimumValue < 0.0))
				{
					minimumValue = 0.0;
				}
				if (autoMaximum && (maximumValue > 2.0))
				{
					maximumValue = 2.0;
				}
			}
			return inter;
		}

		internal double EstimateNumberAxis(ref double minimumValue, ref double maximumValue, bool shouldStartFromZero, int preferredNumberOfIntervals, bool autoMaximum, bool autoMinimum)
		{
			double interval;
			double pointsInterval;
			double num2 = minimumValue;
			double num3 = maximumValue;
			if (!this.roundedXValues && ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2)))
			{
				pointsInterval = this.ChartArea.GetPointsInterval(false, 10.0);
				if ((pointsInterval == 0.0) || (((num3 - num2) / pointsInterval) > 20.0))
				{
					pointsInterval = (num3 - num2) / ((double)preferredNumberOfIntervals);
				}
			}
			else
			{
				pointsInterval = (num3 - num2) / ((double)preferredNumberOfIntervals);
			}
			if ((!double.IsNaN(this.interval3DCorrection) && this.ChartArea.Area3DStyle.Enable3D) && !this.ChartArea.chartAreaIsCurcular)
			{
				pointsInterval /= this.interval3DCorrection;
				if ((num3 - num2) < pointsInterval)
				{
					pointsInterval = num3 - num2;
				}
				this.interval3DCorrection = double.NaN;
				if (pointsInterval != 0.0)
				{
					pointsInterval = this.CalcInterval(pointsInterval);
				}
			}
			if (autoMaximum || autoMinimum)
			{
				if (pointsInterval == 0.0)
				{
					num3 = num2 + 1.0;
					pointsInterval = 0.2;
					interval = 0.2;
				}
				else
				{
					interval = this.CalcInterval(pointsInterval);
				}
			}
			else
			{
				interval = pointsInterval;
			}
			if (((this.interval != 0.0) && (this.interval > interval)) && ((minimumValue + this.interval) > maximumValue))
			{
				interval = this.interval;
				if (autoMaximum)
				{
					maximumValue = minimumValue + interval;
				}
				if (autoMinimum)
				{
					minimumValue = maximumValue - interval;
				}
			}
			if (((this.axisType == AxisName.Y) || (this.axisType == AxisName.Y2)) || (this.roundedXValues && ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2))))
			{
				bool flag = false;
				bool flag2 = false;
				if (this.ChartArea.hundredPercent)
				{
					flag = minimumValue == 0.0;
					flag2 = maximumValue == 0.0;
				}
				this.RoundedValues(interval, shouldStartFromZero, autoMaximum, autoMinimum, ref minimumValue, ref maximumValue);
				if (!this.ChartArea.hundredPercent)
				{
					return interval;
				}
				if (autoMinimum)
				{
					if (minimumValue < -100.0)
					{
						minimumValue = -100.0;
					}
					if (flag)
					{
						minimumValue = 0.0;
					}
				}
				if (!autoMaximum)
				{
					return interval;
				}
				if (maximumValue > 100.0)
				{
					maximumValue = 100.0;
				}
				if (flag2)
				{
					maximumValue = 0.0;
				}
			}
			return interval;
		}

		internal void FillLabels(bool removeFirstRow)
		{
			if (this.LabelStyle.Enabled && this.enabled)
			{
				if (((this.ChartArea != null) && this.ChartArea.chartAreaIsCurcular) && (this.axisType != AxisName.Y))
				{
					ICircularChartType circularChartType = this.ChartArea.GetCircularChartType();
					if ((circularChartType == null) || !circularChartType.XAxisLabelsSupported())
					{
						return;
					}
				}
				bool flag = false;
				foreach (CustomLabel label in this.CustomLabels)
				{
					if (label.customLabel && ((label.RowIndex == 0) || this.ChartArea.chartAreaIsCurcular))
					{
						flag = true;
					}
				}
				if (removeFirstRow)
				{
					if (flag)
					{
						return;
					}
					for (int i = 0; i < this.CustomLabels.Count; i++)
					{
						if (this.CustomLabels[i].RowIndex == 0)
						{
							this.CustomLabels.RemoveAt(i);
							i = -1;
						}
					}
				}
				List<string> xAxesSeries = null;
				switch (this.axisType)
				{
					case AxisName.X:
						xAxesSeries = this.ChartArea.GetXAxesSeries(AxisType.Primary, this.SubAxisName);
						break;

					case AxisName.Y:
						xAxesSeries = this.ChartArea.GetYAxesSeries(AxisType.Primary, this.SubAxisName);
						break;

					case AxisName.X2:
						xAxesSeries = this.ChartArea.GetXAxesSeries(AxisType.Secondary, this.SubAxisName);
						break;

					case AxisName.Y2:
						xAxesSeries = this.ChartArea.GetYAxesSeries(AxisType.Secondary, this.SubAxisName);
						break;
				}
				if (xAxesSeries.Count != 0)
				{
					string[] strArray = new string[xAxesSeries.Count];
					for (int j = 0; j < xAxesSeries.Count; j++)
					{
						strArray[j] = xAxesSeries[j];
					}
					bool flag2 = ChartHelper.SeriesXValuesZeros(base.Common, strArray);
					bool indexedSeries = true;
					if (!flag2)
					{
						indexedSeries = ChartHelper.IndexedSeries(base.Common, strArray);
					}
					int num3 = 0;
					if (this.labelStyle.IsEndLabelVisible)
					{
						num3 = 1;
					}
					IChartType chartType = base.Common.ChartTypeRegistry.GetChartType(this.ChartArea.GetFirstSeries().ChartTypeName);
					bool flag4 = false;
					if (chartType.RequireAxes)
					{
						ChartValueType indexedXValueType;
						if ((this.axisType == AxisName.Y) || (this.axisType == AxisName.Y2))
						{
							flag4 = false;
						}
						else
						{
							flag4 = true;
						}
						if (flag4 && !ChartHelper.SeriesXValuesZeros(base.Common, xAxesSeries.ToArray()))
						{
							flag4 = false;
						}
						if (flag4 && ((this.labelStyle.GetIntervalOffset() != 0.0) || (this.labelStyle.GetInterval() != 0.0)))
						{
							flag4 = false;
						}
						if ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2))
						{
							indexedXValueType = base.Common.DataManager.Series[xAxesSeries[0]].indexedXValueType;
						}
						else
						{
							indexedXValueType = base.Common.DataManager.Series[xAxesSeries[0]].YValueType;
						}
						if ((((this.labelStyle.GetIntervalType() != DateTimeIntervalType.Auto) && (this.labelStyle.GetIntervalType() != DateTimeIntervalType.Number)) && ((indexedXValueType != ChartValueType.Time) && (indexedXValueType != ChartValueType.Date))) && (indexedXValueType != ChartValueType.DateTimeOffset))
						{
							indexedXValueType = ChartValueType.DateTime;
						}
						double viewMaximum = this.ViewMaximum;
						double viewMinimum = this.ViewMinimum;
						if (flag4)
						{
							int numberOfPoints = base.Common.DataManager.GetNumberOfPoints(xAxesSeries.ToArray());
							if (num3 == 1)
							{
								this.CustomLabels.Add(-0.5, 0.5, ValueConverter.FormatValue(base.Common.Chart, this, null, 0.0, this.LabelStyle.Format, indexedXValueType, ChartElementType.AxisLabels), false);
							}
							for (int k = 0; k < numberOfPoints; k++)
							{
								this.CustomLabels.Add(k + 0.5, k + 1.5, ValueConverter.FormatValue(base.Common.Chart, this, null, (double)(k + 1), this.LabelStyle.Format, indexedXValueType, ChartElementType.AxisLabels), false);
							}
							if (num3 == 1)
							{
								this.CustomLabels.Add(numberOfPoints + 0.5, numberOfPoints + 1.5, ValueConverter.FormatValue(base.Common.Chart, this, null, (double)(numberOfPoints + 1), this.LabelStyle.Format, indexedXValueType, ChartElementType.AxisLabels), false);
							}
							foreach (string str in xAxesSeries)
							{
								int num8;
								if (num3 == 1)
								{
									num8 = 1;
								}
								else
								{
									num8 = 0;
								}
								foreach (DataPoint point in base.Common.DataManager.Series[str].Points)
								{
									while (this.CustomLabels[num8].RowIndex > 0)
									{
										num8++;
									}
									if (((this.axisType == AxisName.X) || (this.axisType == AxisName.X2)) && (point.AxisLabel.Length > 0))
									{
										this.CustomLabels[num8].Text = point.AxisLabel;
									}
									num8++;
								}
							}
						}
						else if (viewMinimum != viewMaximum)
						{
							double num9;
							double num10;
							double num11;
							Series series = null;
							if ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2))
							{
								List<string> list2 = this.ChartArea.GetXAxesSeries((this.axisType == AxisName.X) ? AxisType.Primary : AxisType.Secondary, this.SubAxisName);
								if (list2.Count > 0)
								{
									series = base.Common.DataManager.Series[list2[0]];
									if ((series != null) && !series.IsXValueIndexed)
									{
										series = null;
									}
								}
							}
							DateTimeIntervalType type = (this.labelStyle.GetIntervalOffsetType() == DateTimeIntervalType.Auto) ? this.labelStyle.GetIntervalType() : this.labelStyle.GetIntervalOffsetType();
							double start = viewMinimum;
							if ((!this.ChartArea.chartAreaIsCurcular || (this.axisType == AxisName.Y)) || (this.axisType == AxisName.Y2))
							{
								start = ChartHelper.AlignIntervalStart(start, this.labelStyle.GetInterval(), this.labelStyle.GetIntervalType(), series);
							}
							if ((this.labelStyle.GetIntervalOffset() != 0.0) && (series == null))
							{
								start += ChartHelper.GetIntervalSize(start, this.labelStyle.GetIntervalOffset(), type, series, 0.0, DateTimeIntervalType.Number, true, false);
							}
							if (((indexedXValueType != ChartValueType.DateTime) && (indexedXValueType != ChartValueType.Date)) && (((indexedXValueType != ChartValueType.Time) && (indexedXValueType != ChartValueType.DateTimeOffset)) && (series == null)))
							{
								if (start != viewMinimum)
								{
									num3 = 1;
								}
								int num18 = 0;
								for (double m = start - (num3 * this.labelStyle.GetInterval()); m < (viewMaximum - ((1.5 * this.labelStyle.GetInterval()) * (1 - num3))); m = (double)(((decimal)m) + ((decimal)this.labelStyle.GetInterval())))
								{
									num18++;
									if (num18 > 0x2710)
									{
										return;
									}
									num9 = (double)(((decimal)m) + ((decimal)this.labelStyle.GetInterval()));
									double num20 = Math.Log(this.labelStyle.GetInterval());
									double num21 = Math.Log(Math.Abs(num9));
									int digits = ((int)Math.Abs(num20)) + 5;
									if (digits > 15)
									{
										digits = 15;
									}
									if (Math.Abs(num20) < (Math.Abs(num21) - 5.0))
									{
										num9 = Math.Round(num9, digits);
									}
									if (((viewMaximum - start) / this.labelStyle.GetInterval()) > 10000.0)
									{
										return;
									}
									if (this.IsLogarithmic)
									{
										num9 = Math.Pow(this.logarithmBase, num9);
									}
									num10 = (double)(((decimal)m) + (((decimal)this.labelStyle.GetInterval()) * 0.5M));
									num11 = (double)(((decimal)m) + (((decimal)this.labelStyle.GetInterval()) * 1.5M));
									if ((((decimal)num10) <= ((decimal)viewMaximum)) && (((decimal)((num10 + num11) / 2.0)) <= ((decimal)viewMaximum)))
									{
										string text = this.GetPointLabel(xAxesSeries, num9, !flag2, indexedSeries);
										if ((text.Length > 15) && (num9 < 1E-06))
										{
											num9 = 0.0;
										}
										if (text.Length == 0)
										{
											if (!base.Common.DataManager.Series[xAxesSeries[0]].IsXValueIndexed || (m <= this.maximum))
											{
												this.CustomLabels.Add(num10, num11, ValueConverter.FormatValue(base.Common.Chart, this, null, num9, this.LabelStyle.Format, indexedXValueType, ChartElementType.AxisLabels), false);
											}
										}
										else
										{
											this.CustomLabels.Add(num10, num11, text, false);
										}
									}
								}
							}
							else
							{
								double current = start;
								if (((viewMaximum - start) / ChartHelper.GetIntervalSize(start, this.labelStyle.GetInterval(), this.labelStyle.GetIntervalType(), series, 0.0, DateTimeIntervalType.Number, true)) <= 10000.0)
								{
									int num15 = 0;
									double num16 = viewMaximum - (ChartHelper.GetIntervalSize(viewMaximum, this.labelStyle.GetInterval(), this.labelStyle.GetIntervalType(), series, this.labelStyle.GetIntervalOffset(), type, true) / 2.0);
									double num17 = viewMinimum + (ChartHelper.GetIntervalSize(viewMinimum, this.labelStyle.GetInterval(), this.labelStyle.GetIntervalType(), series, this.labelStyle.GetIntervalOffset(), type, true) / 2.0);
									while (((decimal)current) <= ((decimal)viewMaximum))
									{
										double num14 = ChartHelper.GetIntervalSize(current, this.labelStyle.GetInterval(), this.labelStyle.GetIntervalType(), series, this.labelStyle.GetIntervalOffset(), type, true);
										num9 = current;
										if (this.IsLogarithmic)
										{
											num9 = Math.Pow(this.logarithmBase, num9);
										}
										if (num15++ > 0x2710)
										{
											return;
										}
										if ((num3 == 0) && (current >= num16))
										{
											return;
										}
										num10 = current - (num14 * 0.5);
										num11 = current + (num14 * 0.5);
										if ((num3 == 0) && (current <= num17))
										{
											current += num14;
										}
										else
										{
											if (((decimal)num10) > ((decimal)viewMaximum))
											{
												current += num14;
												continue;
											}
											string str2 = this.GetPointLabel(xAxesSeries, num9, !flag2, indexedSeries);
											if (str2.Length == 0)
											{
												if ((current <= this.maximum) && ((current != this.maximum) || !base.Common.DataManager.Series[xAxesSeries[0]].IsXValueIndexed))
												{
													this.CustomLabels.Add(num10, num11, ValueConverter.FormatValue(base.Common.Chart, this, null, num9, this.LabelStyle.Format, indexedXValueType, ChartElementType.AxisLabels), false);
												}
											}
											else
											{
												this.CustomLabels.Add(num10, num11, str2, false);
											}
											current += num14;
										}
									}
								}
							}
						}
					}
				}
			}
		}

		internal SizeF GetArrowSize(out ArrowOrientation arrowOrientation)
		{
			Axis axisX;
			double num;
			double num2;
			arrowOrientation = ArrowOrientation.Top;
			switch (this.AxisPosition)
			{
				case AxisPosition.Left:
					if (!this.isReversed)
					{
						arrowOrientation = ArrowOrientation.Top;
						break;
					}
					arrowOrientation = ArrowOrientation.Bottom;
					break;

				case AxisPosition.Right:
					if (!this.isReversed)
					{
						arrowOrientation = ArrowOrientation.Top;
						break;
					}
					arrowOrientation = ArrowOrientation.Bottom;
					break;

				case AxisPosition.Top:
					if (!this.isReversed)
					{
						arrowOrientation = ArrowOrientation.Right;
						break;
					}
					arrowOrientation = ArrowOrientation.Left;
					break;

				case AxisPosition.Bottom:
					if (!this.isReversed)
					{
						arrowOrientation = ArrowOrientation.Right;
						break;
					}
					arrowOrientation = ArrowOrientation.Left;
					break;
			}
			switch (arrowOrientation)
			{
				case ArrowOrientation.Left:
					axisX = this.ChartArea.AxisX;
					break;

				case ArrowOrientation.Right:
					axisX = this.ChartArea.AxisX2;
					break;

				case ArrowOrientation.Top:
					axisX = this.ChartArea.AxisY2;
					break;

				case ArrowOrientation.Bottom:
					axisX = this.ChartArea.AxisY;
					break;

				default:
					axisX = this.ChartArea.AxisX;
					break;
			}
			if ((arrowOrientation == ArrowOrientation.Top) || (arrowOrientation == ArrowOrientation.Bottom))
			{
				num = this._lineWidth;
				num2 = (this._lineWidth * base.Common.Width) / ((double)base.Common.Height);
			}
			else
			{
				num = (this._lineWidth * base.Common.Width) / ((double)base.Common.Height);
				num2 = this._lineWidth;
			}
			if (this._arrowStyle == AxisArrowStyle.SharpTriangle)
			{
				if ((arrowOrientation != ArrowOrientation.Top) && (arrowOrientation != ArrowOrientation.Bottom))
				{
					return new SizeF(axisX.MajorTickMark.Size + ((float)(num2 * 4.0)), (float)(num * 2.0));
				}
				return new SizeF((float)(num * 2.0), axisX.MajorTickMark.Size + ((float)(num2 * 4.0)));
			}
			if (this._arrowStyle == AxisArrowStyle.None)
			{
				return new SizeF(0f, 0f);
			}
			if ((arrowOrientation != ArrowOrientation.Top) && (arrowOrientation != ArrowOrientation.Bottom))
			{
				return new SizeF(axisX.MajorTickMark.Size + ((float)(num2 * 2.0)), (float)(num * 2.0));
			}
			return new SizeF((float)(num * 2.0), axisX.MajorTickMark.Size + ((float)(num2 * 2.0)));
		}

		internal DateTimeIntervalType GetAxisIntervalType()
		{
			if (this.InternalIntervalType != DateTimeIntervalType.Auto)
			{
				return this.InternalIntervalType;
			}
			if (((this.GetAxisValuesType() != ChartValueType.DateTime) && (this.GetAxisValuesType() != ChartValueType.Date)) && ((this.GetAxisValuesType() != ChartValueType.Time) && (this.GetAxisValuesType() != ChartValueType.DateTimeOffset)))
			{
				return DateTimeIntervalType.Number;
			}
			return DateTimeIntervalType.Years;
		}

		internal double GetAxisPosition()
		{
			return this.GetAxisPosition(false);
		}

		internal virtual double GetAxisPosition(bool ignoreCrossing)
		{
			Axis oppositeAxis = this.GetOppositeAxis();
			if ((this.ChartArea != null) && this.ChartArea.chartAreaIsCurcular)
			{
				return (double)(this.PlotAreaPosition.X + (this.PlotAreaPosition.Width / 2f));
			}
			if ((((oppositeAxis.maximum == oppositeAxis.minimum) || double.IsNaN(oppositeAxis.maximum)) || (double.IsNaN(oppositeAxis.minimum) || (this.maximum == this.minimum))) || (double.IsNaN(this.maximum) || double.IsNaN(this.minimum)))
			{
				switch (this.AxisPosition)
				{
					case AxisPosition.Left:
						return (double)this.PlotAreaPosition.X;

					case AxisPosition.Right:
						return (double)this.PlotAreaPosition.Right;

					case AxisPosition.Top:
						return (double)this.PlotAreaPosition.Y;

					case AxisPosition.Bottom:
						return (double)this.PlotAreaPosition.Bottom;
				}
			}
			if (double.IsNaN(oppositeAxis.crossing) || ignoreCrossing)
			{
				if ((this.axisType != AxisName.X) && (this.axisType != AxisName.Y))
				{
					return oppositeAxis.GetLinearPosition(oppositeAxis.ViewMaximum);
				}
				return oppositeAxis.GetLinearPosition(oppositeAxis.ViewMinimum);
			}
			oppositeAxis.crossing = oppositeAxis.tempCrossing;
			if (oppositeAxis.crossing < oppositeAxis.ViewMinimum)
			{
				oppositeAxis.crossing = oppositeAxis.ViewMinimum;
			}
			else if (oppositeAxis.crossing > oppositeAxis.ViewMaximum)
			{
				oppositeAxis.crossing = oppositeAxis.ViewMaximum;
			}
			return oppositeAxis.GetLinearPosition(oppositeAxis.crossing);
		}

		internal double GetAxisProjectionAngle()
		{
			bool flag;
			float marksZPosition = this.GetMarksZPosition(out flag);
			float axisPosition = (float)this.GetAxisPosition();
			Point3D[] points = new Point3D[2];
			if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
			{
				points[0] = new Point3D(0f, axisPosition, marksZPosition);
				points[1] = new Point3D(100f, axisPosition, marksZPosition);
			}
			else
			{
				points[0] = new Point3D(axisPosition, 0f, marksZPosition);
				points[1] = new Point3D(axisPosition, 100f, marksZPosition);
			}
			this.ChartArea.matrix3D.TransformPoints(points);
			points[0].X = (float)Math.Round((double)points[0].X, 4);
			points[0].Y = (float)Math.Round((double)points[0].Y, 4);
			points[1].X = (float)Math.Round((double)points[1].X, 4);
			points[1].Y = (float)Math.Round((double)points[1].Y, 4);
			double num3 = 0.0;
			if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
			{
				num3 = Math.Atan((double)((points[1].Y - points[0].Y) / (points[1].X - points[0].X)));
			}
			else
			{
				num3 = Math.Atan((double)((points[1].X - points[0].X) / (points[1].Y - points[0].Y)));
			}
			return ((num3 * 180.0) / 3.1415926535897931);
		}

		internal ArrayList GetAxisSeries()
		{
			ArrayList list = new ArrayList();
			foreach (string str in this.ChartArea.Series)
			{
				Series series = base.Common.DataManager.Series[str];
				if ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2))
				{
					if (series.XAxisType == this.GetAxisType())
					{
						list.Add(series);
					}
					continue;
				}
				if (series.YAxisType == this.GetAxisType())
				{
					list.Add(series);
				}
			}
			return list;
		}

		internal AxisType GetAxisType()
		{
			if ((this.axisType != AxisName.X) && (this.axisType != AxisName.Y))
			{
				return AxisType.Secondary;
			}
			return AxisType.Primary;
		}

		internal ChartValueType GetAxisValuesType()
		{
			ChartValueType type = ChartValueType.Double;
			if (((base.Common != null) && (base.Common.DataManager.Series != null)) && (this.ChartArea != null))
			{
				foreach (Series series in base.Common.DataManager.Series)
				{
					bool flag = false;
					if ((series.ChartArea == this.ChartArea.Name) && series.IsVisible())
					{
						if ((this.axisType == AxisName.X) && (series.XAxisType == AxisType.Primary))
						{
							flag = true;
						}
						else if ((this.axisType == AxisName.X2) && (series.XAxisType == AxisType.Secondary))
						{
							flag = true;
						}
						else if ((this.axisType == AxisName.Y) && (series.YAxisType == AxisType.Primary))
						{
							flag = true;
						}
						else if ((this.axisType == AxisName.Y2) && (series.YAxisType == AxisType.Secondary))
						{
							flag = true;
						}
					}
					if (flag)
					{
						if ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2))
						{
							return series.XValueType;
						}
						if ((this.axisType != AxisName.Y) && (this.axisType != AxisName.Y2))
						{
							return type;
						}
						return series.YValueType;
					}
				}
			}
			return type;
		}

		internal void GetCircularAxisLabelsAutoFitFont(ChartGraphics graph, ArrayList axisList, CircularAxisLabelsStyle labelsStyle, RectangleF plotAreaRectAbs, RectangleF areaRectAbs, float labelsSizeEstimate)
		{
			if ((this.IsLabelAutoFit && (this.LabelAutoFitStyle != LabelAutoFitStyles.None)) && this.LabelStyle.Enabled)
			{
				this._minLabelFontSize = Math.Min(this.LabelAutoFitMinFontSize, this.LabelAutoFitMaxFontSize);
				this.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(this.LabelStyle.Font.FontFamily, (float)Math.Max(this.LabelAutoFitMaxFontSize, this.LabelAutoFitMinFontSize), this.LabelStyle.Font.Style, GraphicsUnit.Point);
				if ((this.LabelAutoFitStyle & LabelAutoFitStyles.IncreaseFont) != LabelAutoFitStyles.IncreaseFont)
				{
					this.autoLabelFont = this.LabelStyle.Font;
				}
				bool flag = false;
				while (!flag)
				{
					flag = this.CheckCircularLabelsFit(graph, axisList, labelsStyle, plotAreaRectAbs, areaRectAbs, labelsSizeEstimate);
					if (!flag)
					{
						if ((this.autoLabelFont.SizeInPoints > this._minLabelFontSize) && ((this.LabelAutoFitStyle & LabelAutoFitStyles.DecreaseFont) == LabelAutoFitStyles.DecreaseFont))
						{
							this.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(this.autoLabelFont.FontFamily, this.autoLabelFont.SizeInPoints - 1f, this.autoLabelFont.Style, GraphicsUnit.Point);
						}
						else
						{
							this.autoLabelAngle = 0;
							this.autoLabelOffset = 0;
							flag = true;
						}
					}
				}
			}
		}

		private double GetCrossing()
		{
			if (double.IsNaN(this.crossing))
			{
				if (!base.Common.ChartTypeRegistry.GetChartType((string)this.ChartArea.ChartTypes[0]).ZeroCrossing)
				{
					return this.ViewMinimum;
				}
				if (this.ViewMinimum > 0.0)
				{
					return this.ViewMinimum;
				}
				if (this.ViewMaximum < 0.0)
				{
					return this.ViewMaximum;
				}
				return 0.0;
			}
			if (this.crossing == double.MaxValue)
			{
				return this.ViewMaximum;
			}
			if (this.crossing == double.MinValue)
			{
				return this.ViewMinimum;
			}
			return this.crossing;
		}

		internal ChartValueType GetDateTimeType()
		{
			List<string> xAxesSeries = null;
			ChartValueType auto = ChartValueType.Auto;
			if (this.axisType == AxisName.X)
			{
				xAxesSeries = this.ChartArea.GetXAxesSeries(AxisType.Primary, this.SubAxisName);
				if (xAxesSeries.Count == 0)
				{
					return ChartValueType.Auto;
				}
				if (base.Common.DataManager.Series[xAxesSeries[0]].IsXValueDateTime())
				{
					auto = base.Common.DataManager.Series[xAxesSeries[0]].XValueType;
				}
				return auto;
			}
			if (this.axisType == AxisName.X2)
			{
				xAxesSeries = this.ChartArea.GetXAxesSeries(AxisType.Secondary, this.SubAxisName);
				if (xAxesSeries.Count == 0)
				{
					return ChartValueType.Auto;
				}
				if (base.Common.DataManager.Series[xAxesSeries[0]].IsXValueDateTime())
				{
					auto = base.Common.DataManager.Series[xAxesSeries[0]].XValueType;
				}
				return auto;
			}
			if (this.axisType == AxisName.Y)
			{
				xAxesSeries = this.ChartArea.GetYAxesSeries(AxisType.Primary, this.SubAxisName);
				if (xAxesSeries.Count == 0)
				{
					return ChartValueType.Auto;
				}
				if (base.Common.DataManager.Series[xAxesSeries[0]].IsYValueDateTime())
				{
					auto = base.Common.DataManager.Series[xAxesSeries[0]].YValueType;
				}
				return auto;
			}
			if (this.axisType == AxisName.Y2)
			{
				xAxesSeries = this.ChartArea.GetYAxesSeries(AxisType.Secondary, this.SubAxisName);
				if (xAxesSeries.Count == 0)
				{
					return ChartValueType.Auto;
				}
				if (base.Common.DataManager.Series[xAxesSeries[0]].IsYValueDateTime())
				{
					auto = base.Common.DataManager.Series[xAxesSeries[0]].YValueType;
				}
			}
			return auto;
		}

		internal int GetGroupLabelLevelCount()
		{
			int num = 0;
			foreach (CustomLabel label in this.CustomLabels)
			{
				if (label.RowIndex > 0)
				{
					num = Math.Max(num, label.RowIndex);
				}
			}
			return num;
		}

		internal float GetGroupLablesToatalSize()
		{
			float num = 0f;
			if ((this.groupingLabelSizes != null) && (this.groupingLabelSizes.Length > 0))
			{
				foreach (float num2 in this.groupingLabelSizes)
				{
					num += num2;
				}
			}
			return num;
		}

		internal bool GetIsMarksNextToAxis()
		{
			return (((this.ChartArea != null) && this.ChartArea.chartAreaIsCurcular) || this.IsMarksNextToAxis);
		}

		internal double GetLinearPosition(double axisValue)
		{
			bool flag = (this.ChartArea != null) && this.ChartArea.chartAreaIsCurcular;
			if (!this.optimizedGetPosition)
			{
				this.paintViewMax = this.ViewMaximum;
				this.paintViewMin = this.ViewMinimum;
				this.paintRange = this.paintViewMax - this.paintViewMin;
				this.paintAreaPosition = this.PlotAreaPosition.ToRectangleF();
				if (flag)
				{
					this.paintAreaPosition.Width /= 2f;
					this.paintAreaPosition.Height /= 2f;
				}
				this.paintAreaPositionBottom = this.paintAreaPosition.Y + this.paintAreaPosition.Height;
				this.paintAreaPositionRight = this.paintAreaPosition.X + this.paintAreaPosition.Width;
				if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
				{
					this.paintChartAreaSize = this.paintAreaPosition.Width;
				}
				else
				{
					this.paintChartAreaSize = this.paintAreaPosition.Height;
				}
				this.valueMultiplier = 0.0;
				if (this.paintRange != 0.0)
				{
					this.valueMultiplier = this.paintChartAreaSize / this.paintRange;
				}
			}
			double num = this.valueMultiplier * (axisValue - this.paintViewMin);
			if (this.scaleSegmentsUsed)
			{
				AxisScaleSegment segment = this.ScaleSegments.FindScaleSegmentForAxisValue(axisValue);
				if (segment != null)
				{
					double scaleSize = 0.0;
					double scalePosition = 0.0;
					segment.GetScalePositionAndSize(this.paintChartAreaSize, out scalePosition, out scaleSize);
					if (!this.ScaleSegments.AllowOutOfScaleValues)
					{
						if (axisValue > segment.ScaleMaximum)
						{
							axisValue = segment.ScaleMaximum;
						}
						else if (axisValue < segment.ScaleMinimum)
						{
							axisValue = segment.ScaleMinimum;
						}
					}
					double num4 = segment.ScaleMaximum - segment.ScaleMinimum;
					num = (scaleSize / num4) * (axisValue - segment.ScaleMinimum);
					num += scalePosition;
				}
			}
			if (this.isReversed)
			{
				if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
				{
					return (this.paintAreaPositionRight - num);
				}
				return (this.paintAreaPosition.Y + num);
			}
			if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
			{
				return (this.paintAreaPosition.X + num);
			}
			return (this.paintAreaPositionBottom - num);
		}

		internal double GetLogValue(double yValue)
		{
			if (this.IsLogarithmic)
			{
				yValue = Math.Log(yValue, this.logarithmBase);
			}
			return yValue;
		}

		internal float GetMarksZPosition(out bool axisOnEdge)
		{
			axisOnEdge = this.IsAxisOnAreaEdge;
			if (!this.GetIsMarksNextToAxis())
			{
				axisOnEdge = true;
			}
			float areaSceneDepth = 0f;
			if ((this.AxisPosition == AxisPosition.Bottom) && (this.ChartArea.IsBottomSceneWallVisible() || !axisOnEdge))
			{
				areaSceneDepth = this.ChartArea.areaSceneDepth;
			}
			if ((this.AxisPosition == AxisPosition.Left) && (this.ChartArea.IsSideSceneWallOnLeft() || !axisOnEdge))
			{
				areaSceneDepth = this.ChartArea.areaSceneDepth;
			}
			if ((this.AxisPosition == AxisPosition.Right) && (!this.ChartArea.IsSideSceneWallOnLeft() || !axisOnEdge))
			{
				areaSceneDepth = this.ChartArea.areaSceneDepth;
			}
			if ((this.AxisPosition == AxisPosition.Top) && !axisOnEdge)
			{
				areaSceneDepth = this.ChartArea.areaSceneDepth;
			}
			if (this.ChartArea.IsMainSceneWallOnFront())
			{
				areaSceneDepth = (areaSceneDepth == 0f) ? this.ChartArea.areaSceneDepth : 0f;
			}
			return areaSceneDepth;
		}

		internal static string GetName(AxisName axisName)
		{
			switch (axisName)
			{
				case AxisName.X:
					return "X axis";

				case AxisName.Y:
					return "Y (Value) axis";

				case AxisName.X2:
					return "Secondary X axis";

				case AxisName.Y2:
					return "Secondary Y (Value) axis";
			}
			return null;
		}

		private int GetNumOfUnits(double min, double max, DateTimeIntervalType type)
		{
			double num = ChartHelper.GetIntervalSize(min, 1.0, type);
			return (int)Math.Round((double)((max - min) / num));
		}

		internal Axis GetOppositeAxis()
		{
			if (this.oppositeAxis == null)
			{
				List<string> xAxesSeries;
				switch (this.axisType)
				{
					case AxisName.X:
						xAxesSeries = this.ChartArea.GetXAxesSeries(AxisType.Primary, this.SubAxisName);
						if (xAxesSeries.Count != 0)
						{
							if (base.Common.DataManager.Series[xAxesSeries[0]].YAxisType == AxisType.Primary)
							{
								this.oppositeAxis = this.ChartArea.AxisY.GetSubAxis(base.Common.DataManager.Series[xAxesSeries[0]].YSubAxisName);
							}
							else
							{
								this.oppositeAxis = this.ChartArea.AxisY2.GetSubAxis(base.Common.DataManager.Series[xAxesSeries[0]].YSubAxisName);
							}
							break;
						}
						this.oppositeAxis = this.ChartArea.AxisY;
						break;

					case AxisName.Y:
						xAxesSeries = this.ChartArea.GetYAxesSeries(AxisType.Primary, this.SubAxisName);
						if (xAxesSeries.Count != 0)
						{
							if (base.Common.DataManager.Series[xAxesSeries[0]].XAxisType == AxisType.Primary)
							{
								this.oppositeAxis = this.ChartArea.AxisX.GetSubAxis(base.Common.DataManager.Series[xAxesSeries[0]].XSubAxisName);
							}
							else
							{
								this.oppositeAxis = this.ChartArea.AxisX2.GetSubAxis(base.Common.DataManager.Series[xAxesSeries[0]].XSubAxisName);
							}
							break;
						}
						this.oppositeAxis = this.ChartArea.AxisX;
						break;

					case AxisName.X2:
						xAxesSeries = this.ChartArea.GetXAxesSeries(AxisType.Secondary, this.SubAxisName);
						if (xAxesSeries.Count != 0)
						{
							if (base.Common.DataManager.Series[xAxesSeries[0]].YAxisType == AxisType.Primary)
							{
								this.oppositeAxis = this.ChartArea.AxisY.GetSubAxis(base.Common.DataManager.Series[xAxesSeries[0]].YSubAxisName);
							}
							else
							{
								this.oppositeAxis = this.ChartArea.AxisY2.GetSubAxis(base.Common.DataManager.Series[xAxesSeries[0]].YSubAxisName);
							}
							break;
						}
						this.oppositeAxis = this.ChartArea.AxisY2;
						break;

					case AxisName.Y2:
						xAxesSeries = this.ChartArea.GetYAxesSeries(AxisType.Secondary, this.SubAxisName);
						if (xAxesSeries.Count != 0)
						{
							if (base.Common.DataManager.Series[xAxesSeries[0]].XAxisType == AxisType.Primary)
							{
								this.oppositeAxis = this.ChartArea.AxisX.GetSubAxis(base.Common.DataManager.Series[xAxesSeries[0]].XSubAxisName);
							}
							else
							{
								this.oppositeAxis = this.ChartArea.AxisX2.GetSubAxis(base.Common.DataManager.Series[xAxesSeries[0]].XSubAxisName);
							}
							break;
						}
						this.oppositeAxis = this.ChartArea.AxisX2;
						break;
				}
			}
			return this.oppositeAxis;
		}

		internal Axis GetOtherTypeAxis()
		{
			return this.ChartArea.GetAxis(this.axisType, (this.GetAxisType() == AxisType.Primary) ? AxisType.Secondary : AxisType.Primary, string.Empty);
		}

		internal float GetPixelInterval(double realInterval)
		{
			double num;
			if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
			{
				num = this.PlotAreaPosition.Right - this.PlotAreaPosition.X;
			}
			else
			{
				num = this.PlotAreaPosition.Bottom - this.PlotAreaPosition.Y;
			}
			if ((this.ViewMaximum - this.ViewMinimum) == 0.0)
			{
				return (float)(num / realInterval);
			}
			return (float)((num / (this.ViewMaximum - this.ViewMinimum)) * realInterval);
		}

		private string GetPointLabel(List<string> series, double valuePosition, bool nonZeroXValues, bool indexedSeries)
		{
			int num = 0;
			foreach (string str in series)
			{
				Series series2 = base.Common.DataManager.Series[str];
				num = Math.Max(num, series2.Points.Count);
			}
			bool flag = true;
			foreach (string str2 in series)
			{
				Series series3 = base.Common.DataManager.Series[str2];
				if ((((this.axisType == AxisName.X) || (this.axisType == AxisName.X2)) && (((this.margin != 0.0) || (num == 1)) || !this._autoMinimum)) && ((!series3.IsXValueIndexed && (series3.Points[0].AxisLabel.Length > 0)) && (series3.Points[series3.Points.Count - 1].AxisLabel.Length > 0)))
				{
					flag = false;
				}
				if (!series3.noLabelsInPoints || (nonZeroXValues && indexedSeries))
				{
					string str3 = this.GetPointLabel(series3, valuePosition, nonZeroXValues, indexedSeries);
					if (!string.IsNullOrEmpty(str3))
					{
						return str3;
					}
				}
				string str4 = series3["__IndexedSeriesLabelsSource__"];
				if (!string.IsNullOrEmpty(str4))
				{
					Series series4 = base.Common.DataManager.Series[str4];
					if (series4 != null)
					{
						string str5 = this.GetPointLabel(series4, valuePosition, nonZeroXValues, true);
						if (!string.IsNullOrEmpty(str5))
						{
							return str5;
						}
					}
				}
			}
			if (!flag)
			{
				return " ";
			}
			return "";
		}

		private string GetPointLabel(Series series, double valuePosition, bool nonZeroXValues, bool indexedSeries)
		{
			int num = 1;
			if ((this.axisType != AxisName.Y) && (this.axisType != AxisName.Y2))
			{
				if (((this.axisType != AxisName.X) || (series.XAxisType != AxisType.Primary)) && ((this.axisType != AxisName.X2) || (series.XAxisType != AxisType.Secondary)))
				{
					return "";
				}
				foreach (DataPoint point in series.Points)
				{
					if (indexedSeries)
					{
						if (valuePosition == num)
						{
							if ((point.AxisLabel.Length == 0) && nonZeroXValues)
							{
								return ValueConverter.FormatValue(base.Common.Chart, this, null, point.XValue, this.LabelStyle.Format, series.XValueType, ChartElementType.AxisLabels);
							}
							return point.ReplaceKeywords(point.AxisLabel);
						}
					}
					else if (point.XValue == valuePosition)
					{
						return point.ReplaceKeywords(point.AxisLabel);
					}
					num++;
				}
			}
			return "";
		}

		public double GetPosition(double axisValue)
		{
			if (this._isLogarithmic && (axisValue != 0.0))
			{
				axisValue = Math.Log(axisValue, this.logarithmBase);
			}
			return this.GetLinearPosition(axisValue);
		}

		private float[] GetRequiredGroupLabelSize(ChartGraphics chartGraph, float maxLabelSize)
		{
			float[] numArray = null;
			int groupLabelLevelCount = this.GetGroupLabelLevelCount();
			if (groupLabelLevelCount > 0)
			{
				numArray = new float[groupLabelLevelCount];
				for (int i = 1; i <= groupLabelLevelCount; i++)
				{
					numArray[i - 1] = 0f;
					foreach (CustomLabel label in this.CustomLabels)
					{
						if (label.RowIndex == 0)
						{
							double num3 = (label.FromPosition + label.ToPosition) / 2.0;
							if ((num3 < this.ViewMinimum) || (num3 > this.ViewMaximum))
							{
								continue;
							}
						}
						if (label.RowIndex == i)
						{
							SizeF ef = chartGraph.MeasureStringRel(label.Text.Replace(@"\n", "\n"), (this.autoLabelFont != null) ? this.autoLabelFont : this.LabelStyle.Font);
							ef.Width = (float)Math.Ceiling((double)ef.Width);
							ef.Height = (float)Math.Ceiling((double)ef.Height);
							if (label.Image.Length > 0)
							{
								SizeF size = new SizeF();
								if (base.Common.ImageLoader.GetAdjustedImageSize(label.Image, chartGraph.Graphics, ref size))
								{
									SizeF relativeSize = chartGraph.GetRelativeSize(size);
									ef.Width += relativeSize.Width;
									ef.Height = Math.Max(ef.Height, relativeSize.Height);
								}
							}
							if (label.LabelMark == LabelMarkStyle.Box)
							{
								SizeF ef4 = chartGraph.GetRelativeSize(new SizeF(4f, 4f));
								ef.Width += ef4.Width;
								ef.Height += ef4.Height;
							}
							if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
							{
								numArray[i - 1] = Math.Max(numArray[i - 1], ef.Height);
							}
							else
							{
								ef.Width = chartGraph.GetAbsoluteSize(new SizeF(ef.Height, ef.Height)).Height;
								ef.Width = chartGraph.GetRelativeSize(new SizeF(ef.Width, ef.Width)).Width;
								numArray[i - 1] = Math.Max(numArray[i - 1], ef.Width);
							}
							float single1 = maxLabelSize / ((float)groupLabelLevelCount);
							float single2 = numArray[i - 1];
						}
					}
				}
			}
			return numArray;
		}

		private float GetRequiredLabelSize(ChartGraphics chartGraph, float maxLabelSize, out float resultSize)
		{
			float num = 0f;
			resultSize = 0f;
			float num2 = (this.autoLabelAngle < -90) ? ((float)this.LabelStyle.Angle) : ((float)this.autoLabelAngle);
			this.labelNearOffset = float.MaxValue;
			this.labelFarOffset = float.MinValue;
			using (StringFormat format = new StringFormat())
			{
				format.FormatFlags |= StringFormatFlags.LineLimit;
				format.Trimming = StringTrimming.EllipsisCharacter;
				RectangleF ef = this.ChartArea.Position.ToRectangleF();
				foreach (CustomLabel label in this.CustomLabels)
				{
					if (label.RowIndex == 0)
					{
						double num3 = (label.FromPosition + label.ToPosition) / 2.0;
						if ((num3 < this.ViewMinimum) || (num3 > this.ViewMaximum))
						{
							continue;
						}
					}
					if (label.RowIndex != 0)
					{
						continue;
					}
					RectangleF ef2 = ef;
					ef2.Width = maxLabelSize;
					double linearPosition = this.GetLinearPosition(label.FromPosition);
					double num5 = this.GetLinearPosition(label.ToPosition);
					ef2.Y = (float)Math.Min(linearPosition, num5);
					ef2.Height = ((float)Math.Max(linearPosition, num5)) - ef2.Y;
					if ((this.autoLabelOffset == -1) ? this.LabelStyle.IsStaggered : (this.autoLabelOffset == 1))
					{
						ef2.Y -= ef2.Height / 2f;
						ef2.Height *= 2f;
					}
					if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
					{
						float num6 = ef2.Height;
						ef2.Height = ef2.Width;
						ef2.Width = num6;
						if (num2 != 0f)
						{
							format.FormatFlags |= StringFormatFlags.DirectionVertical;
						}
					}
					else
					{
						if (num2 == 90f || num2 == -90f)
						{
							num2 = 0f;
							format.FormatFlags |= StringFormatFlags.DirectionVertical;
						}
					}
					ef2.Width = (float)Math.Ceiling((double)ef2.Width);
					ef2.Height = (float)Math.Ceiling((double)ef2.Height);
					SizeF ef3 = chartGraph.MeasureStringRel(label.Text.Replace(@"\n", "\n"), (this.autoLabelFont != null) ? this.autoLabelFont : this.LabelStyle.Font, ef2.Size, format);
					if ((ef3.Width == 0f) || (ef3.Height == 0f))
					{
						format.FormatFlags ^= StringFormatFlags.LineLimit;
						ef3 = chartGraph.MeasureStringRel(label.Text.Replace(@"\n", "\n"), (this.autoLabelFont != null) ? this.autoLabelFont : this.LabelStyle.Font, ef2.Size, format);
						format.FormatFlags |= StringFormatFlags.LineLimit;
					}
					if (label.Image.Length > 0)
					{
						SizeF size = new SizeF();
						if (base.Common.ImageLoader.GetAdjustedImageSize(label.Image, chartGraph.Graphics, ref size))
						{
							SizeF relativeSize = chartGraph.GetRelativeSize(size);
							if ((format.FormatFlags & StringFormatFlags.DirectionVertical) == StringFormatFlags.DirectionVertical)
							{
								ef3.Height += relativeSize.Height;
								ef3.Width = Math.Max(ef3.Width, relativeSize.Width);
							}
							else
							{
								ef3.Width += relativeSize.Width;
								ef3.Height = Math.Max(ef3.Height, relativeSize.Height);
							}
						}
					}
					if (label.LabelMark == LabelMarkStyle.Box)
					{
						SizeF ef6 = chartGraph.GetRelativeSize(new SizeF(4f, 4f));
						ef3.Width += ef6.Width;
						ef3.Height += ef6.Height;
					}
					float width = ef3.Width;
					float height = ef3.Height;
					if (num2 != 0f)
					{
						width = ((float)Math.Cos(((90f - Math.Abs(num2)) / 180f) * 3.1415926535897931)) * ef3.Width;
						width += ((float)Math.Cos((Math.Abs(num2) / 180f) * 3.1415926535897931)) * ef3.Height;
						height = ((float)Math.Sin((Math.Abs(num2) / 180f) * 3.1415926535897931)) * ef3.Height;
						height += ((float)Math.Sin(((90f - Math.Abs(num2)) / 180f) * 3.1415926535897931)) * ef3.Width;
					}
					width = ((float)Math.Ceiling((double)width)) * 1.05f;
					height = ((float)Math.Ceiling((double)height)) * 1.05f;
					ef3.Width = ((float)Math.Ceiling((double)ef3.Width)) * 1.05f;
					ef3.Height = ((float)Math.Ceiling((double)ef3.Height)) * 1.05f;
					if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
					{
						if (num2 == 0f || num2 == 90f || num2 == -90f)
						{
							resultSize = Math.Max(resultSize, ef3.Height);
							num = Math.Max(num, ef3.Height);
							this.labelNearOffset = (float)Math.Min((double)this.labelNearOffset, ((linearPosition + num5) / 2.0) - (ef3.Width / 2f));
							this.labelFarOffset = (float)Math.Max((double)this.labelFarOffset, ((linearPosition + num5) / 2.0) + (ef3.Width / 2f));
							goto Label_0741;
						}
						resultSize = Math.Max(resultSize, ef3.Height);
						num = Math.Max(num, height);
						if (num2 > 0f)
						{
							this.labelFarOffset = (float)Math.Max((double)this.labelFarOffset, ((linearPosition + num5) / 2.0) + (width * 1.1f));
						}
						else
						{
							this.labelNearOffset = (float)Math.Min((double)this.labelNearOffset, ((linearPosition + num5) / 2.0) - (width * 1.1f));
						}
					}
					else
					{
						if (num2 == 0f || num2 == 90f || num2 == -90f)
						{
							resultSize = Math.Max(resultSize, ef3.Width);
							num = Math.Max(num, ef3.Width);
							this.labelNearOffset = (float)Math.Min((double)this.labelNearOffset, ((linearPosition + num5) / 2.0) - (ef3.Height / 2f));
							this.labelFarOffset = (float)Math.Max((double)this.labelFarOffset, ((linearPosition + num5) / 2.0) + (ef3.Height / 2f));
							goto Label_0741;
						}
						resultSize = Math.Max(resultSize, ef3.Width);
						num = Math.Max(num, width);
						if (num2 > 0f)
							this.labelFarOffset = (float)Math.Max((double)this.labelFarOffset, ((linearPosition + num5) / 2.0) + (height * 1.1f));
						else
							this.labelNearOffset = (float)Math.Min((double)this.labelNearOffset, ((linearPosition + num5) / 2.0) - (height * 1.1f));
					}
				Label_0741:
					if (resultSize > maxLabelSize)
					{
						resultSize = maxLabelSize;
					}
				}
			}
			if ((this.autoLabelOffset == -1) ? this.LabelStyle.IsStaggered : (this.autoLabelOffset == 1))
			{
				resultSize *= 2f;
				num *= 2f;
				if (resultSize > maxLabelSize)
				{
					resultSize = maxLabelSize;
					num = maxLabelSize;
				}
			}
			if (this.ChartArea.Area3DStyle.Enable3D && !this.ChartArea.chartAreaIsCurcular)
			{
				resultSize *= 1.1f;
				num *= 1.1f;
			}
			return num;
		}

		internal Axis GetSubAxis(string subAxisName)
		{
			return this;
		}

		private TextOrientation GetTextOrientation()
		{
			if (this.TextOrientation != TextOrientation.Auto)
			{
				return this.TextOrientation;
			}
			if (this.AxisPosition == AxisPosition.Left)
			{
				return TextOrientation.Rotated270;
			}
			if (this.AxisPosition == AxisPosition.Right)
			{
				return TextOrientation.Rotated90;
			}
			return TextOrientation.Horizontal;
		}

		private double IncreaseLabelInterval(double oldInterval, ref DateTimeIntervalType axisIntervalType)
		{
			double num = oldInterval;
			double num2 = this.maximum - this.minimum;
			int num3 = 0;
			if (((axisIntervalType == DateTimeIntervalType.Auto) || (axisIntervalType == DateTimeIntervalType.NotSet)) || (axisIntervalType == DateTimeIntervalType.Number))
			{
				double num4 = 2.0;
				do
				{
					num = this.CalcInterval(num2 / (num2 / (num * num4)));
					if (num == oldInterval)
					{
						num4 *= 2.0;
					}
					num3++;
				}
				while ((num == oldInterval) && (num3 <= 100));
				return num;
			}
			num = oldInterval * 2.0;
			if (axisIntervalType != DateTimeIntervalType.Years)
			{
				if (axisIntervalType == DateTimeIntervalType.Months)
				{
					if (num >= 12.0)
					{
						num = 1.0;
						axisIntervalType = DateTimeIntervalType.Years;
					}
					return num;
				}
				if (axisIntervalType == DateTimeIntervalType.Weeks)
				{
					if (num >= 4.0)
					{
						num = 1.0;
						axisIntervalType = DateTimeIntervalType.Months;
					}
					return num;
				}
				if (axisIntervalType == DateTimeIntervalType.Days)
				{
					if (num >= 7.0)
					{
						num = 1.0;
						axisIntervalType = DateTimeIntervalType.Weeks;
					}
					return num;
				}
				if (axisIntervalType == DateTimeIntervalType.Hours)
				{
					if (num >= 60.0)
					{
						num = 1.0;
						axisIntervalType = DateTimeIntervalType.Days;
					}
					return num;
				}
				if (axisIntervalType == DateTimeIntervalType.Minutes)
				{
					if (num >= 60.0)
					{
						num = 1.0;
						axisIntervalType = DateTimeIntervalType.Hours;
					}
					return num;
				}
				if (axisIntervalType == DateTimeIntervalType.Seconds)
				{
					if (num >= 60.0)
					{
						num = 1.0;
						axisIntervalType = DateTimeIntervalType.Minutes;
					}
					return num;
				}
				if ((axisIntervalType == DateTimeIntervalType.Milliseconds) && (num >= 1000.0))
				{
					num = 1.0;
					axisIntervalType = DateTimeIntervalType.Seconds;
				}
			}
			return num;
		}

		private void Initialize(AxisName axisTypeName)
		{
			if (this.labelStyle == null)
			{
				this.labelStyle = new LabelStyle(this);
			}
			if (this._customLabels == null)
			{
				this._customLabels = new CustomLabelsCollection(this);
			}
			if (this._scaleView == null)
			{
				this._scaleView = new AxisScaleView(this);
			}
			this.axisType = axisTypeName;
			if (this.minorTickMark == null)
			{
				this.minorTickMark = new TickMark(this, false);
			}
			if (this.majorTickMark == null)
			{
				this.majorTickMark = new TickMark(this, true);
				this.majorTickMark.Interval = double.NaN;
				this.majorTickMark.IntervalOffset = double.NaN;
				this.majorTickMark.IntervalType = DateTimeIntervalType.NotSet;
				this.majorTickMark.IntervalOffsetType = DateTimeIntervalType.NotSet;
			}
			if (this.minorGrid == null)
			{
				this.minorGrid = new Grid(this, false);
			}
			if (this.majorGrid == null)
			{
				this.majorGrid = new Grid(this, true);
				this.majorGrid.Interval = double.NaN;
				this.majorGrid.IntervalOffset = double.NaN;
				this.majorGrid.IntervalType = DateTimeIntervalType.NotSet;
				this.majorGrid.IntervalOffsetType = DateTimeIntervalType.NotSet;
			}
			if (this._stripLines == null)
			{
				this._stripLines = new StripLinesCollection(this);
			}
			this._titleFont = this._fontCache.DefaultFont;
			if (this.scaleSegments == null)
			{
				this.scaleSegments = new AxisScaleSegmentCollection(this);
			}
			if (this.axisScaleBreakStyle == null)
			{
				this.axisScaleBreakStyle = new AxisScaleBreakStyle(this);
			}
		}

		internal void Initialize(ChartArea chartArea, AxisName axisTypeName)
		{
			this.Initialize(axisTypeName);
			this.Parent = chartArea;
			this.Name = GetName(axisTypeName);
		}

		private bool IsArrowInAxis(ArrowOrientation arrowOrientation, AxisPosition axisPosition)
		{
			return (((axisPosition == AxisPosition.Top) && (arrowOrientation == ArrowOrientation.Top)) || (((axisPosition == AxisPosition.Bottom) && (arrowOrientation == ArrowOrientation.Bottom)) || (((axisPosition == AxisPosition.Left) && (arrowOrientation == ArrowOrientation.Left)) || ((axisPosition == AxisPosition.Right) && (arrowOrientation == ArrowOrientation.Right)))));
		}

		internal bool IsCustomGridLines()
		{
			if (this.CustomLabels.Count > 0)
			{
				foreach (CustomLabel label in this.CustomLabels)
				{
					if ((label.GridTicks & GridTickTypes.Gridline) == GridTickTypes.Gridline)
					{
						return true;
					}
				}
			}
			return false;
		}

		internal bool IsCustomTickMarks()
		{
			if (this.CustomLabels.Count > 0)
			{
				foreach (CustomLabel label in this.CustomLabels)
				{
					if ((label.GridTicks & GridTickTypes.TickMark) == GridTickTypes.TickMark)
					{
						return true;
					}
				}
			}
			return false;
		}

		private bool IsVariableLabelCountModeEnabled()
		{
			if (((this.IntervalAutoMode == IntervalAutoMode.VariableCount) || (this.ScaleSegments.Count > 0)) && (!this.IsLogarithmic && ((this.tempLabelInterval <= 0.0) || (double.IsNaN(this.tempLabelInterval) && (this.Interval <= 0.0)))))
			{
				if (!this.ChartArea.requireAxes)
				{
					return false;
				}
				bool flag = false;
				foreach (CustomLabel label in this.CustomLabels)
				{
					if (label.customLabel && (label.RowIndex == 0))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					return true;
				}
			}
			return false;
		}

		internal void Paint(ChartGraphics graph)
		{
			if ((this.ChartArea != null) && this.ChartArea.chartAreaIsCurcular)
			{
				if ((this.axisType == AxisName.Y) && this.enabled)
				{
					ICircularChartType circularChartType = this.ChartArea.GetCircularChartType();
					if (circularChartType != null)
					{
						Matrix transform = graph.Transform;
						float[] yAxisLocations = circularChartType.GetYAxisLocations(this.ChartArea);
						bool flag = true;
						foreach (float num in yAxisLocations)
						{
							Matrix matrix2 = transform.Clone();
							matrix2.RotateAt(num, graph.GetAbsolutePoint(this.ChartArea.circularCenter));
							graph.Transform = matrix2;
							this.DrawAxisLineHotRegion(graph, false);
							this.minorTickMark.Paint(graph, false);
							this.majorTickMark.Paint(graph, false);
							this.DrawAxisLine(graph, false);
							if (flag)
							{
								flag = false;
								int angle = this.labelStyle.Angle;
								if (this.labelStyle.Angle == 0)
								{
									if ((num >= 45f) && (num <= 180f))
									{
										this.labelStyle.Angle = -90;
									}
									else if ((num > 180f) && (num <= 315f))
									{
										this.labelStyle.Angle = 90;
									}
								}
								this.labelStyle.Paint(graph, false);
								this.labelStyle.Angle = angle;
							}
						}
						graph.Transform = transform;
					}
				}
				if ((this.axisType == AxisName.X) && this.enabled)
				{
					this.labelStyle.PaintCircular(graph);
				}
				this.DrawAxisTitle(graph);
			}
			else
			{
				if (this.enabled)
				{
					this.DrawAxisLineHotRegion(graph, false);
					this.minorTickMark.Paint(graph, false);
					this.majorTickMark.Paint(graph, false);
					this.DrawAxisLine(graph, false);
					this.labelStyle.Paint(graph, false);
				}
				this.DrawAxisTitle(graph);
				this.ResetTempAxisOffset();
			}
		}

		internal void PaintGrids(ChartGraphics graph)
		{
			object obj2;
			this.PaintGrids(graph, out obj2);
		}

		internal void PaintGrids(ChartGraphics graph, out object obj)
		{
			obj = null;
			if (this.enabled)
			{
				this.minorGrid.Paint(graph);
				this.majorGrid.Paint(graph);
			}
		}

		internal void PaintOnSegmentedScalePassOne(ChartGraphics graph)
		{
			if (this.enabled)
			{
				this.minorTickMark.Paint(graph, false);
				this.majorTickMark.Paint(graph, false);
			}
		}

		internal void PaintOnSegmentedScalePassTwo(ChartGraphics graph)
		{
			if (this.enabled)
			{
				this.DrawAxisLine(graph, false);
				this.labelStyle.Paint(graph, false);
			}
			this.DrawAxisTitle(graph);
			this.ResetTempAxisOffset();
		}

		internal void PaintStrips(ChartGraphics graph, bool drawLinesOnly)
		{
			object obj2;
			this.PaintStrips(graph, false, 0, 0, out obj2, drawLinesOnly);
		}

		internal void PaintStrips(ChartGraphics graph, bool selectionMode, int x, int y, out object obj, bool drawLinesOnly)
		{
			obj = null;
			if (this.enabled)
			{
				bool flag = this.AddInterlacedStrip();
				foreach (StripLine line in this.StripLines)
				{
					line.Paint(graph, base.Common, drawLinesOnly);
				}
				if (flag)
				{
					this.StripLines.RemoveAt(0);
				}
			}
		}

		public double PixelPositionToValue(double position)
		{
			double num = position;
			if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
			{
				num *= 100f / ((float)(base.Common.ChartPicture.Width - 1));
			}
			else
			{
				num *= 100f / ((float)(base.Common.ChartPicture.Height - 1));
			}
			return this.PositionToValue(num);
		}

		public double PositionToValue(double position)
		{
			return this.PositionToValue(position, true);
		}

		internal double PositionToValue(double position, bool validateInput)
		{
			double width;
			if (validateInput && ((position < 0.0) || (position > 100.0)))
			{
				throw new ArgumentException(SR.ExceptionAxisScalePositionInvalid, "position");
			}
			if (this.PlotAreaPosition == null)
			{
				throw new InvalidOperationException(SR.ExceptionAxisScalePositionToValueCallFailed);
			}
			if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
			{
				position -= this.PlotAreaPosition.X;
			}
			else
			{
				position = this.PlotAreaPosition.Bottom - position;
			}
			if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
			{
				width = this.PlotAreaPosition.Width;
			}
			else
			{
				width = this.PlotAreaPosition.Height;
			}
			double viewMaximum = this.ViewMaximum;
			double viewMinimum = this.ViewMinimum;
			double num4 = viewMaximum - viewMinimum;
			double num5 = 0.0;
			if (num4 != 0.0)
			{
				num5 = (num4 / width) * position;
			}
			if (this.isReversed)
			{
				return (viewMaximum - num5);
			}
			return (viewMinimum + num5);
		}

		internal void PostFillLabels()
		{
			foreach (CustomLabel label in this.CustomLabels)
			{
				if (label.customLabel)
				{
					return;
				}
			}
			if (((this.LabelStyle.Enabled && this.enabled) && ((string.IsNullOrEmpty(this.SubAxisName) && (this.axisType != AxisName.Y)) && (this.axisType != AxisName.Y2))) && (this.GetAxisSeries().Count <= 0))
			{
				this.CustomLabels.Clear();
				foreach (CustomLabel label2 in this.GetOtherTypeAxis().CustomLabels)
				{
					this.CustomLabels.Add(label2.Clone());
				}
			}
		}

		internal void PrePaint(ChartGraphics graph)
		{
			if (this.enabled)
			{
				this.DrawAxisLineHotRegion(graph, true);
				this.majorTickMark.Paint(graph, true);
				this.minorTickMark.Paint(graph, true);
				this.DrawAxisLine(graph, true);
				this.labelStyle.Paint(graph, true);
			}
		}

		internal void ReCalc(ElementPosition position)
		{
			this.PlotAreaPosition = position;
		}

		private double ReduceLabelInterval(double oldInterval, double minInterval, ref DateTimeIntervalType axisIntervalType)
		{
			double num = oldInterval;
			double num2 = this.maximum - this.minimum;
			int num3 = 0;
			if (((axisIntervalType == DateTimeIntervalType.Auto) || (axisIntervalType == DateTimeIntervalType.NotSet)) || (axisIntervalType == DateTimeIntervalType.Number))
			{
				double num4 = 2.0;
				do
				{
					num = this.CalcInterval(num2 / (num2 / (num / num4)));
					if (num == oldInterval)
					{
						num4 *= 2.0;
					}
					num3++;
				}
				while ((num == oldInterval) && (num3 <= 100));
			}
			else
			{
				if ((oldInterval > 1.0) || (oldInterval < 1.0))
				{
					if ((axisIntervalType == DateTimeIntervalType.Minutes) || (axisIntervalType == DateTimeIntervalType.Seconds))
					{
						if (oldInterval >= 60.0)
						{
							num = Math.Round((double)(oldInterval / 2.0));
						}
						else if (oldInterval >= 30.0)
						{
							num = 15.0;
						}
						else if (oldInterval >= 15.0)
						{
							num = 5.0;
						}
						else if (oldInterval >= 5.0)
						{
							num = 1.0;
						}
					}
					else
					{
						num = Math.Round((double)(oldInterval / 2.0));
					}
					if (num < 1.0)
					{
						num = 1.0;
					}
				}
				if (oldInterval == 1.0)
				{
					if (axisIntervalType == DateTimeIntervalType.Years)
					{
						num = 6.0;
						axisIntervalType = DateTimeIntervalType.Months;
					}
					else if (axisIntervalType == DateTimeIntervalType.Months)
					{
						num = 2.0;
						axisIntervalType = DateTimeIntervalType.Weeks;
					}
					else if (axisIntervalType == DateTimeIntervalType.Weeks)
					{
						num = 2.0;
						axisIntervalType = DateTimeIntervalType.Days;
					}
					else if (axisIntervalType == DateTimeIntervalType.Days)
					{
						num = 12.0;
						axisIntervalType = DateTimeIntervalType.Hours;
					}
					else if (axisIntervalType == DateTimeIntervalType.Hours)
					{
						num = 30.0;
						axisIntervalType = DateTimeIntervalType.Minutes;
					}
					else if (axisIntervalType == DateTimeIntervalType.Minutes)
					{
						num = 30.0;
						axisIntervalType = DateTimeIntervalType.Seconds;
					}
					else if (axisIntervalType == DateTimeIntervalType.Seconds)
					{
						num = 100.0;
						axisIntervalType = DateTimeIntervalType.Milliseconds;
					}
				}
			}
			if (!double.IsNaN(minInterval) && (num < minInterval))
			{
				num = 0.0;
			}
			return num;
		}

		internal void ResetAutoValues()
		{
			this.refreshMinMaxFromData = true;
			this.maximum = this.tempMaximum;
			this.minimum = this.tempMinimum;
			this.crossing = this.tempCrossing;
			this._autoMinimum = this.tempAutoMinimum;
			this._autoMaximum = this.tempAutoMaximum;
			this.majorGrid.interval = this.tempMajorGridInterval;
			this.majorTickMark.interval = this.tempMajorTickMarkInterval;
			this.minorGrid.interval = this.tempMinorGridInterval;
			this.minorTickMark.interval = this.tempMinorTickMarkInterval;
			this.labelStyle._Interval = this.tempLabelInterval;
			this.majorGrid.intervalType = this.tempGridIntervalType;
			this.majorTickMark.intervalType = this.tempTickMarkIntervalType;
			this.labelStyle._IntervalType = this.tempLabelIntervalType;
			if ((base.Common.Chart != null) && !base.Common.Chart.Serializing)
			{
				this.ScaleView.Position = this._originalViewPosition;
			}
			this._storeValuesEnabled = true;
		}

		internal void ResetAxisValues()
		{
			this.paintMode = false;
			this.ResetAutoValues();
			if (this.tempLabels != null)
			{
				this.CustomLabels.Clear();
				foreach (CustomLabel label in this.tempLabels)
				{
					this.CustomLabels.Add(label.Clone());
				}
				this.tempLabels = null;
			}
		}

		internal void ResetTempAxisOffset()
		{
			if (this.offsetTempSet)
			{
				this.minorTickMark.intervalOffset = this._intervalsStore.Pop();
				this.minorGrid.intervalOffset = this._intervalsStore.Pop();
				this.majorTickMark.intervalOffset = this._intervalsStore.Pop();
				this.majorGrid.intervalOffset = this._intervalsStore.Pop();
				this.labelStyle._IntervalOffset = this._intervalsStore.Pop();
				int num = 0;
				foreach (StripLine line in this.StripLines)
				{
					if (this._stripLineOffsets.Count > num)
					{
						line.IntervalOffset = (double)this._stripLineOffsets[num];
					}
					num++;
				}
				this._stripLineOffsets.Clear();
				this.offsetTempSet = false;
				this.margin = this.marginTemp;
			}
		}

		internal virtual void Resize(ChartGraphics chartGraph, ElementPosition chartAreaPosition, RectangleF plotArea, float axesNumber, bool autoPlotPosition)
		{
			this.PlotAreaPosition = chartAreaPosition;
			this.PlotAreaPosition.FromRectangleF(plotArea);
			this.titleSize = 0f;
			if (this.Title.Length > 0)
			{
				SizeF ef = chartGraph.MeasureStringRel(this.Title.Replace(@"\n", "\n"), this.TitleFont, new SizeF(10000f, 10000f), StringFormat.GenericTypographic, this.GetTextOrientation());
				float num = 0f;
				if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
				{
					num = (plotArea.Height / 100f) * (20f / axesNumber);
					if (this.IsTextVertical)
					{
						this.titleSize = Math.Min(ef.Width, num);
					}
					else
					{
						this.titleSize = Math.Min(ef.Height, num);
					}
				}
				else
				{
					num = (plotArea.Width / 100f) * (20f / axesNumber);
					if (this.IsTextVertical)
					{
						ef.Width = chartGraph.GetAbsoluteSize(new SizeF(ef.Height, ef.Height)).Height;
						ef.Width = chartGraph.GetRelativeSize(new SizeF(ef.Width, ef.Width)).Width;
						this.titleSize = Math.Min(ef.Width, (plotArea.Width / 100f) * (20f / axesNumber));
					}
					else
					{
						this.titleSize = Math.Min(ef.Width, (plotArea.Width / 100f) * (20f / axesNumber));
					}
				}
			}
			if (this.titleSize > 0f)
			{
				this.titleSize++;
			}
			float num2 = 0f;
			SizeF empty = SizeF.Empty;
			SizeF arrowSize = SizeF.Empty;
			ArrowOrientation bottom = ArrowOrientation.Bottom;
			if ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2))
			{
				if (this.ChartArea.AxisY.ArrowStyle != AxisArrowStyle.None)
				{
					empty = this.ChartArea.AxisY.GetArrowSize(out bottom);
					if (!this.IsArrowInAxis(bottom, this.AxisPosition))
					{
						empty = SizeF.Empty;
					}
				}
				if (this.ChartArea.AxisY2.ArrowStyle != AxisArrowStyle.None)
				{
					arrowSize = this.ChartArea.AxisY2.GetArrowSize(out bottom);
					if (!this.IsArrowInAxis(bottom, this.AxisPosition))
					{
						arrowSize = SizeF.Empty;
					}
				}
			}
			else
			{
				if (this.ChartArea.AxisX.ArrowStyle != AxisArrowStyle.None)
				{
					empty = this.ChartArea.AxisX.GetArrowSize(out bottom);
					if (!this.IsArrowInAxis(bottom, this.AxisPosition))
					{
						empty = SizeF.Empty;
					}
				}
				if (this.ChartArea.AxisX2.ArrowStyle != AxisArrowStyle.None)
				{
					arrowSize = this.ChartArea.AxisX2.GetArrowSize(out bottom);
					if (!this.IsArrowInAxis(bottom, this.AxisPosition))
					{
						arrowSize = SizeF.Empty;
					}
				}
			}
			if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
			{
				num2 = Math.Max(empty.Height, arrowSize.Height);
			}
			else
			{
				num2 = Math.Max(empty.Width, arrowSize.Width);
			}
			this.markSize = 0f;
			float size = 0f;
			if (this.MajorTickMark.Enabled && (this.MajorTickMark.TickMarkStyle != TickMarkStyle.None))
			{
				if (this.MajorTickMark.TickMarkStyle == TickMarkStyle.InsideArea)
				{
					size = 0f;
				}
				else if (this.MajorTickMark.TickMarkStyle == TickMarkStyle.AcrossAxis)
				{
					size = this.MajorTickMark.Size / 2f;
				}
				else if (this.MajorTickMark.TickMarkStyle == TickMarkStyle.OutsideArea)
				{
					size = this.MajorTickMark.Size;
				}
			}
			float num4 = 0f;
			if ((this.MinorTickMark.Enabled && (this.MinorTickMark.TickMarkStyle != TickMarkStyle.None)) && (this.MinorTickMark.GetInterval() != 0.0))
			{
				if (this.MinorTickMark.TickMarkStyle == TickMarkStyle.InsideArea)
				{
					num4 = 0f;
				}
				else if (this.MinorTickMark.TickMarkStyle == TickMarkStyle.AcrossAxis)
				{
					num4 = this.MinorTickMark.Size / 2f;
				}
				else if (this.MinorTickMark.TickMarkStyle == TickMarkStyle.OutsideArea)
				{
					num4 = this.MinorTickMark.Size;
				}
			}
			this.markSize += Math.Max(size, num4);
			SizeF relativeSize = chartGraph.GetRelativeSize(new SizeF((float)this.LineWidth, (float)this.LineWidth));
			if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
			{
				this.markSize += relativeSize.Height / 2f;
				this.markSize = Math.Min(this.markSize, (plotArea.Height / 100f) * (20f / axesNumber));
			}
			else
			{
				this.markSize += relativeSize.Width / 2f;
				this.markSize = Math.Min(this.markSize, (plotArea.Width / 100f) * (20f / axesNumber));
			}
			this.scrollBarSize = 0f;
			if ((this.ChartArea.Area3DStyle.Enable3D && !this.ChartArea.chartAreaIsCurcular) && ((this.ChartArea.BackColor != Color.Transparent) && (this.ChartArea.Area3DStyle.WallWidth > 0)))
			{
				SizeF ef5 = chartGraph.GetRelativeSize(new SizeF((float)this.ChartArea.Area3DStyle.WallWidth, (float)this.ChartArea.Area3DStyle.WallWidth));
				if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
				{
					this.markSize += ef5.Height;
				}
				else
				{
					this.markSize += ef5.Width;
				}
			}
			if (num2 > ((this.markSize + this.scrollBarSize) + this.titleSize))
			{
				this.markSize = Math.Max(this.markSize, num2 - ((this.markSize + this.scrollBarSize) + this.titleSize));
				this.markSize = Math.Min(this.markSize, (plotArea.Width / 100f) * (20f / axesNumber));
			}
			float height = 0f;
			if (!autoPlotPosition)
			{
				if (this.GetIsMarksNextToAxis())
				{
					if (this.AxisPosition == AxisPosition.Top)
					{
						height = ((float)this.GetAxisPosition()) - this.ChartArea.Position.Y;
					}
					else if (this.AxisPosition == AxisPosition.Bottom)
					{
						height = this.ChartArea.Position.Bottom - ((float)this.GetAxisPosition());
					}
					if (this.AxisPosition == AxisPosition.Left)
					{
						height = ((float)this.GetAxisPosition()) - this.ChartArea.Position.X;
					}
					else if (this.AxisPosition == AxisPosition.Right)
					{
						height = this.ChartArea.Position.Right - ((float)this.GetAxisPosition());
					}
				}
				else
				{
					if (this.AxisPosition == AxisPosition.Top)
					{
						height = plotArea.Y - this.ChartArea.Position.Y;
					}
					else if (this.AxisPosition == AxisPosition.Bottom)
					{
						height = this.ChartArea.Position.Bottom - plotArea.Bottom;
					}
					if (this.AxisPosition == AxisPosition.Left)
					{
						height = plotArea.X - this.ChartArea.Position.X;
					}
					else if (this.AxisPosition == AxisPosition.Right)
					{
						height = this.ChartArea.Position.Right - plotArea.Right;
					}
				}
				height *= 2f;
			}
			else if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
			{
				height = plotArea.Height;
			}
			else
			{
				height = plotArea.Width;
			}
			if (((this.Enabled != AxisEnabled.False) && this.LabelStyle.Enabled) && this.IsVariableLabelCountModeEnabled())
			{
				float num6 = 3f;
				if (((this.AxisPosition == AxisPosition.Left) || (this.AxisPosition == AxisPosition.Right)) && ((this.LabelStyle.Angle == 90) || (this.LabelStyle.Angle == -90)))
				{
					num6 = 0f;
				}
				if (((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom)) && ((this.LabelStyle.Angle == 180) || (this.LabelStyle.Angle == 0)))
				{
					num6 = 0f;
				}
				if (this.ChartArea.Area3DStyle.Enable3D)
				{
					num6++;
				}
				this.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(this.LabelStyle.Font.FontFamily, this.LabelStyle.Font.Size + num6, this.LabelStyle.Font.Style, GraphicsUnit.Point);
				this.autoLabelAngle = this.LabelStyle.Angle;
				this.autoLabelOffset = this.LabelStyle.IsStaggered ? 1 : 0;
				this.AdjustIntervalToFitLabels(chartGraph, autoPlotPosition, false);
			}
			this.autoLabelFont = null;
			this.autoLabelAngle = -1000;
			this.autoLabelOffset = -1;
			if ((this.IsLabelAutoFit && (this.LabelAutoFitStyle != LabelAutoFitStyles.None)) && !this.ChartArea.chartAreaIsCurcular)
			{
				bool flag = false;
				bool flag2 = false;
				this.autoLabelAngle = 0;
				this.autoLabelOffset = 0;
				CustomLabelsCollection labelss = null;
				float num7 = 8f;
				num7 = Math.Max(this.LabelAutoFitMaxFontSize, this.LabelAutoFitMinFontSize);
				this._minLabelFontSize = Math.Min(this.LabelAutoFitMinFontSize, this.LabelAutoFitMaxFontSize);
				this._aveLabelFontSize = this._minLabelFontSize + (Math.Abs((float)(num7 - this._minLabelFontSize)) / 2f);
				if (this.ChartArea.IsSameFontSizeForAllAxes)
				{
					num7 = Math.Min(num7, this.ChartArea.axesAutoFontSize);
				}
				this.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(this.LabelStyle.Font.FontFamily, num7, this.LabelStyle.Font.Style, GraphicsUnit.Point);
				if ((this.LabelAutoFitStyle & LabelAutoFitStyles.IncreaseFont) != LabelAutoFitStyles.IncreaseFont)
				{
					this.autoLabelFont = this.LabelStyle.Font;
				}
				float num8 = 0f;
				while (!flag)
				{
					bool checkLabelsFirstRowOnly = true;
					if ((this.LabelAutoFitStyle & LabelAutoFitStyles.DecreaseFont) == LabelAutoFitStyles.DecreaseFont)
					{
						checkLabelsFirstRowOnly = false;
					}
					flag = this.CheckLabelsFit(chartGraph, ((this.markSize + this.scrollBarSize) + this.titleSize) + num8, autoPlotPosition, checkLabelsFirstRowOnly, false);
					if (!flag)
					{
						if ((this.autoLabelFont.SizeInPoints >= this._aveLabelFontSize) && ((this.LabelAutoFitStyle & LabelAutoFitStyles.DecreaseFont) == LabelAutoFitStyles.DecreaseFont))
						{
							this.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(this.autoLabelFont.FontFamily, this.autoLabelFont.SizeInPoints - 0.5f, this.autoLabelFont.Style, GraphicsUnit.Point);
						}
						else
						{
							if (((!this.ChartArea.Area3DStyle.Enable3D && !this.ChartArea.chartAreaIsCurcular) && ((labelss == null) && (this.autoLabelAngle == 0))) && ((this.autoLabelOffset == 0) && ((this.LabelAutoFitStyle & LabelAutoFitStyles.StaggeredLabels) == LabelAutoFitStyles.StaggeredLabels)))
							{
								this.autoLabelOffset = 1;
								continue;
							}
							if (!flag2 && ((this.LabelAutoFitStyle & LabelAutoFitStyles.WordWrap) == LabelAutoFitStyles.WordWrap))
							{
								this.autoLabelOffset = 0;
								if (labelss == null)
								{
									labelss = new CustomLabelsCollection(this);
									foreach (CustomLabel label in this.CustomLabels)
									{
										labelss.Add(label.Clone());
									}
								}
								if (!this.WordWrapLongestLabel(this.CustomLabels))
								{
									flag2 = true;
									if (labelss != null)
									{
										this.CustomLabels.Clear();
										foreach (CustomLabel label2 in labelss)
										{
											this.CustomLabels.Add(label2.Clone());
										}
										labelss = null;
									}
									if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
									{
										if ((((num8 == 0f) || (num8 == 30f)) || (num8 == 20f)) && ((((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep30) == LabelAutoFitStyles.LabelsAngleStep30) || ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep45) == LabelAutoFitStyles.LabelsAngleStep45)) || ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep90) == LabelAutoFitStyles.LabelsAngleStep90)))
										{
											this.autoLabelAngle = 90;
											flag2 = false;
											if (num8 == 0f)
											{
												num8 = 30f;
												continue;
											}
											else if (num8 == 30f)
											{
												num8 = 20f;
												continue;
											}
											if (num8 == 20f)
											{
												num8 = 5f;
												continue;
											}
											this.autoLabelAngle = 0;
											flag2 = true;
										}
										else
										{
											num8 = 0f;
										}
									}
								}
								continue;
							}
							if ((this.autoLabelAngle != 90) && ((((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep30) == LabelAutoFitStyles.LabelsAngleStep30) || ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep45) == LabelAutoFitStyles.LabelsAngleStep45)) || ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep90) == LabelAutoFitStyles.LabelsAngleStep90)))
							{
								num8 = 0f;
								this.autoLabelOffset = 0;
								if ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep30) == LabelAutoFitStyles.LabelsAngleStep30)
								{
									this.autoLabelAngle += this.ChartArea.Area3DStyle.Enable3D ? 0x2d : 30;
								}
								else if ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep45) == LabelAutoFitStyles.LabelsAngleStep45)
								{
									this.autoLabelAngle += 0x2d;
								}
								else if ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep90) == LabelAutoFitStyles.LabelsAngleStep90)
								{
									this.autoLabelAngle += 90;
								}
								continue;
							}
							if ((this.autoLabelFont.SizeInPoints > this._minLabelFontSize) && ((this.LabelAutoFitStyle & LabelAutoFitStyles.DecreaseFont) == LabelAutoFitStyles.DecreaseFont))
							{
								this.autoLabelAngle = 0;
								this.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(this.autoLabelFont.FontFamily, this.autoLabelFont.SizeInPoints - 0.5f, this.autoLabelFont.Style, GraphicsUnit.Point);
							}
							else
							{
								if ((((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep30) == LabelAutoFitStyles.LabelsAngleStep30) || ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep45) == LabelAutoFitStyles.LabelsAngleStep45)) || ((this.LabelAutoFitStyle & LabelAutoFitStyles.LabelsAngleStep90) == LabelAutoFitStyles.LabelsAngleStep90))
								{
									if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
									{
										this.autoLabelAngle = 90;
									}
									else
									{
										this.autoLabelAngle = 0;
									}
								}
								if ((this.LabelAutoFitStyle & LabelAutoFitStyles.StaggeredLabels) == LabelAutoFitStyles.StaggeredLabels)
								{
									this.autoLabelOffset = 0;
								}
								flag = true;
							}
						}
					}
					else if ((this.ChartArea.Area3DStyle.Enable3D && !this.ChartArea.chartAreaIsCurcular) && (this.autoLabelFont.SizeInPoints > this._minLabelFontSize))
					{
						this.autoLabelFont = base.Common.Chart.ChartPicture.FontCache.GetFont(this.autoLabelFont.FontFamily, this.autoLabelFont.SizeInPoints - 0.5f, this.autoLabelFont.Style, GraphicsUnit.Point);
					}
				}
				if (((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top)) && (this.autoLabelAngle == 90))
				{
					this.autoLabelAngle = -90;
				}
			}
			this.labelSize = 0f;
			if (this.LabelStyle.Enabled)
			{
				this.labelSize = ((75f - this.markSize) - this.scrollBarSize) - this.titleSize;
				if (this.labelSize > 0f)
				{
					this.groupingLabelSizes = this.GetRequiredGroupLabelSize(chartGraph, (height / 100f) * 45f);
					this.totlaGroupingLabelsSize = this.GetGroupLablesToatalSize();
				}
				this.labelSize -= this.totlaGroupingLabelsSize;
				if (this.labelSize > 0f)
				{
					if ((this.AxisPosition == AxisPosition.Bottom) || (this.AxisPosition == AxisPosition.Top))
					{
						this.labelSize = 1f + this.GetRequiredLabelSize(chartGraph, (height / 100f) * (((75f - this.markSize) - this.scrollBarSize) - this.titleSize), out this.unRotatedLabelSize);
					}
					else
					{
						this.labelSize = 1f + this.GetRequiredLabelSize(chartGraph, (height / 100f) * (((75f - this.markSize) - this.scrollBarSize) - this.titleSize), out this.unRotatedLabelSize);
					}
					if (!this.LabelStyle.Enabled)
					{
						this.labelSize--;
					}
				}
				else
				{
					this.labelSize = 0f;
				}
				this.labelSize += this.totlaGroupingLabelsSize;
			}
		}

		public void RoundAxisValues()
		{
			this.roundedXValues = true;
		}

		internal double RoundedValues(double inter, bool shouldStartFromZero, bool autoMax, bool autoMin, ref double min, ref double max)
		{
			if ((this.axisType == AxisName.X) || (this.axisType == AxisName.X2))
			{
				if ((this.margin == 0.0) && !this.roundedXValues)
				{
					return inter;
				}
			}
			else if (this.margin == 0.0)
			{
				return inter;
			}
			if (autoMin)
			{
				if ((min < 0.0) || (!shouldStartFromZero && !this.ChartArea.stacked))
					min = (Math.Ceiling(min / inter) - 1) * inter;
				else
					min = 0.0;
			}
			if (autoMax)
			{
				if ((max <= 0.0) && shouldStartFromZero)
				{
					max = 0.0;
					return inter;
				}

				max = (Math.Floor(max / inter) + 1) * inter;
			}
			return inter;
		}

		internal void SetAutoMaximum(double max)
		{
			if (this._autoMaximum)
			{
				this.maximum = max;
			}
		}

		internal void SetAutoMinimum(double min)
		{
			if (this._autoMinimum)
			{
				this.minimum = min;
			}
		}

		internal void SetAxisPosition()
		{
			if (this.GetOppositeAxis().isReversed)
			{
				if (this.AxisPosition == AxisPosition.Left)
				{
					this.AxisPosition = AxisPosition.Right;
				}
				else if (this.AxisPosition == AxisPosition.Right)
				{
					this.AxisPosition = AxisPosition.Left;
				}
				else if (this.AxisPosition == AxisPosition.Top)
				{
					this.AxisPosition = AxisPosition.Bottom;
				}
				else if (this.AxisPosition == AxisPosition.Bottom)
				{
					this.AxisPosition = AxisPosition.Top;
				}
			}
		}

		internal void SetIntervalAndType(double newInterval, DateTimeIntervalType newIntervalType)
		{
			if ((this.tempMajorGridInterval <= 0.0) || (double.IsNaN(this.tempMajorGridInterval) && (this.Interval <= 0.0)))
			{
				this.majorGrid.interval = newInterval;
				this.majorGrid.intervalType = newIntervalType;
			}
			if ((this.tempMajorTickMarkInterval <= 0.0) || (double.IsNaN(this.tempMajorTickMarkInterval) && (this.Interval <= 0.0)))
			{
				this.majorTickMark.interval = newInterval;
				this.majorTickMark.intervalType = newIntervalType;
			}
			if ((this.tempLabelInterval <= 0.0) || (double.IsNaN(this.tempLabelInterval) && (this.Interval <= 0.0)))
			{
				this.labelStyle._Interval = newInterval;
				this.labelStyle._IntervalType = newIntervalType;
			}
			this.Invalidate();
		}

		private Matrix SetRotationTransformation(ChartGraphics graph, RectangleF titlePosition)
		{
			Matrix matrix = graph.Transform.Clone();
			PointF empty = PointF.Empty;
			empty.X = titlePosition.X + (titlePosition.Width / 2f);
			empty.Y = titlePosition.Y + (titlePosition.Height / 2f);
			float angle = (this.GetTextOrientation() == TextOrientation.Rotated90) ? 90f : -90f;
			Matrix matrix2 = graph.Transform.Clone();
			matrix2.RotateAt(angle, graph.GetAbsolutePoint(empty));
			graph.Transform = matrix2;
			return matrix;
		}

		internal void SetTempAxisOffset()
		{
			if (this.ChartArea.Series.Count != 0)
			{
				Series firstSeries = this.ChartArea.GetFirstSeries();
				if (((((firstSeries.ChartType == SeriesChartType.Column) || (firstSeries.ChartType == SeriesChartType.StackedColumn)) || ((firstSeries.ChartType == SeriesChartType.StackedColumn100) || (firstSeries.ChartType == SeriesChartType.Bar))) || (((firstSeries.ChartType == SeriesChartType.RangeBar) || (firstSeries.ChartType == SeriesChartType.RangeColumn)) || ((firstSeries.ChartType == SeriesChartType.StackedBar) || (firstSeries.ChartType == SeriesChartType.StackedBar100)))) && (((this.margin != 100.0) && !this.offsetTempSet) && this._autoMinimum))
				{
					double num2;
					this.marginTemp = this.margin;
					string stringToParse = firstSeries["PointWidth"];
					if (stringToParse != null)
					{
						num2 = CommonElements.ParseDouble(stringToParse);
					}
					else
					{
						num2 = 0.8;
					}
					this.margin = (num2 / 2.0) * 100.0;
					double num = this.margin / 100.0;
					double num3 = (100.0 - this.margin) / 100.0;
					if (this._intervalsStore.Count == 0)
					{
						this._intervalsStore.Push(this.labelStyle._IntervalOffset);
						this._intervalsStore.Push(this.majorGrid.intervalOffset);
						this._intervalsStore.Push(this.majorTickMark.intervalOffset);
						this._intervalsStore.Push(this.minorGrid.intervalOffset);
						this._intervalsStore.Push(this.minorTickMark.intervalOffset);
					}
					this.labelStyle._IntervalOffset = double.IsNaN(this.labelStyle._IntervalOffset) ? num : (this.labelStyle._IntervalOffset + num);
					this.majorGrid.intervalOffset = double.IsNaN(this.majorGrid.intervalOffset) ? num : (this.majorGrid.intervalOffset + num);
					this.majorTickMark.intervalOffset = double.IsNaN(this.majorTickMark.intervalOffset) ? num : (this.majorTickMark.intervalOffset + num);
					this.minorGrid.intervalOffset = double.IsNaN(this.minorGrid.intervalOffset) ? num : (this.minorGrid.intervalOffset + num);
					this.minorTickMark.intervalOffset = double.IsNaN(this.minorTickMark.intervalOffset) ? num : (this.minorTickMark.intervalOffset + num);
					foreach (StripLine line in this.StripLines)
					{
						this._stripLineOffsets.Add(line.IntervalOffset);
						line.IntervalOffset -= num3;
					}
					this.offsetTempSet = true;
				}
			}
		}

		internal void StoreAxisValues()
		{
			this.tempLabels = new CustomLabelsCollection(this);
			foreach (CustomLabel label in this.CustomLabels)
			{
				this.tempLabels.Add(label.Clone());
			}
			this.paintMode = true;
			if (this._storeValuesEnabled)
			{
				this.tempMaximum = this.maximum;
				this.tempMinimum = this.minimum;
				this.tempCrossing = this.crossing;
				this.tempAutoMinimum = this._autoMinimum;
				this.tempAutoMaximum = this._autoMaximum;
				this.tempMajorGridInterval = this.majorGrid.interval;
				this.tempMajorTickMarkInterval = this.majorTickMark.interval;
				this.tempMinorGridInterval = this.minorGrid.interval;
				this.tempMinorTickMarkInterval = this.minorTickMark.interval;
				this.tempGridIntervalType = this.majorGrid.intervalType;
				this.tempTickMarkIntervalType = this.majorTickMark.intervalType;
				this.tempLabelInterval = this.labelStyle._Interval;
				this.tempLabelIntervalType = this.labelStyle._IntervalType;
				this._originalViewPosition = this.ScaleView.Position;
				this._storeValuesEnabled = false;
			}
		}

		public double ValueToPixelPosition(double axisValue)
		{
			double num = this.ValueToPosition(axisValue);
			if ((this.AxisPosition == AxisPosition.Top) || (this.AxisPosition == AxisPosition.Bottom))
			{
				return (num * (((float)(base.Common.ChartPicture.Width - 1)) / 100f));
			}
			return (num * (((float)(base.Common.ChartPicture.Height - 1)) / 100f));
		}

		public double ValueToPosition(double axisValue)
		{
			return this.GetPosition(axisValue);
		}

		private bool WordWrapLongestLabel(CustomLabelsCollection labels)
		{
			bool flag = false;
			ArrayList list = new ArrayList(labels.Count);
			foreach (CustomLabel label in labels)
			{
				list.Add(label.Text.Split(new char[] { '\n' }));
			}
			int length = 5;
			int num2 = -1;
			int index = -1;
			int num4 = 0;
			foreach (string[] strArray in list)
			{
				for (int i = 0; i < strArray.Length; i++)
				{
					if ((strArray[i].Length > length) && (strArray[i].Trim().IndexOf(' ') > 0))
					{
						length = strArray[i].Length;
						num2 = num4;
						index = i;
					}
				}
				num4++;
			}
			if ((num2 >= 0) && (index >= 0))
			{
				string str = ((string[])list[num2])[index];
				for (num4 = 0; num4 < ((str.Length / 2) - 1); num4++)
				{
					if (str[(str.Length / 2) - num4] == ' ')
					{
						str = str.Substring(0, (str.Length / 2) - num4) + "\n" + str.Substring(((str.Length / 2) - num4) + 1);
						flag = true;
					}
					else if (str[(str.Length / 2) + num4] == ' ')
					{
						str = str.Substring(0, (str.Length / 2) + num4) + "\n" + str.Substring(((str.Length / 2) + num4) + 1);
						flag = true;
					}
					if (flag)
					{
						((string[])list[num2])[index] = str;
						break;
					}
				}
				if (flag)
				{
					CustomLabel label2 = labels[num2];
					label2.Text = string.Empty;
					for (int j = 0; j < ((string[])list[num2]).Length; j++)
					{
						if (j > 0)
						{
							label2.Text = label2.Text + "\n";
						}
						label2.Text = label2.Text + ((string[])list[num2])[j];
					}
				}
			}
			return flag;
		}

		[PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeAppearance"), Bindable(true), DefaultValue(0), NotifyParentProperty(true), SRDescription("DescriptionAttributeArrows")]
		public AxisArrowStyle ArrowStyle
		{
			get
			{
				return this._arrowStyle;
			}
			set
			{
				this._arrowStyle = value;
				this.Invalidate();
			}
		}

		internal bool AutoMaximum
		{
			get
			{
				return this._autoMaximum;
			}
		}

		internal bool AutoMinimum
		{
			get
			{
				return this._autoMinimum;
			}
		}

		[Browsable(false), SRCategory("CategoryAttributeAppearance"), Bindable(true), SerializationVisibility(SerializationVisibility.Hidden), DefaultValue(""), SRDescription("DescriptionAttributeType"), PersistenceMode(PersistenceMode.Attribute), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public virtual AxisName AxisName
		{
			get
			{
				return this.axisType;
			}
		}

		[Bindable(true), NotifyParentProperty(true), SerializationVisibility(SerializationVisibility.Hidden), DefaultValue(0), SRDescription("DescriptionAttributeReverse"), PersistenceMode(PersistenceMode.Attribute), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		internal virtual AxisPosition AxisPosition
		{
			get
			{
				return this._axisPosition;
			}
			set
			{
				this._axisPosition = value;
				this.Invalidate();
			}
		}

		internal ChartArea ChartArea
		{
			get
			{
				return (this.Parent as ChartArea);
			}
		}

		[PersistenceMode(PersistenceMode.Attribute), DefaultValue(double.NaN), NotifyParentProperty(true), SRDescription("DescriptionAttributeCrossing"), SRCategory("CategoryAttributeScale"), TypeConverter(typeof(AxisCrossingValueConverter)), Bindable(true)]
		public virtual double Crossing
		{
			get
			{
				if (!this.paintMode)
				{
					return this.crossing;
				}
				if (this._isLogarithmic)
				{
					return Math.Pow(this.logarithmBase, this.GetCrossing());
				}
				return this.GetCrossing();
			}
			set
			{
				this.crossing = value;
				this.tempCrossing = this.crossing;
				this.Invalidate();
			}
		}

		[Bindable(true), Editor(typeof(ChartCollectionEditor), typeof(UITypeEditor)), PersistenceMode(PersistenceMode.InnerProperty), SRCategory("CategoryAttributeLabels"), SRDescription("DescriptionAttributeCustomLabels")]
		public CustomLabelsCollection CustomLabels
		{
			get
			{
				return this._customLabels;
			}
		}

		[NotifyParentProperty(true), DefaultValue(typeof(AxisEnabled), "Auto"), SRCategory("CategoryAttributeMisc"), SRDescription("DescriptionAttributeEnabled7"), PersistenceMode(PersistenceMode.Attribute), Bindable(true)]
		public AxisEnabled Enabled
		{
			get
			{
				if (this.autoEnabled)
				{
					return AxisEnabled.Auto;
				}
				if (this.enabled)
				{
					return AxisEnabled.True;
				}
				return AxisEnabled.False;
			}
			set
			{
				if (value == AxisEnabled.Auto)
				{
					this.autoEnabled = true;
				}
				else if (value == AxisEnabled.True)
				{
					this.enabled = true;
					this.autoEnabled = false;
				}
				else
				{
					this.enabled = false;
					this.autoEnabled = false;
				}
				this.Invalidate();
			}
		}

		[Editor(typeof(ChartColorEditor), typeof(UITypeEditor)), NotifyParentProperty(true), SRCategory("CategoryAttributeAppearance"), Bindable(true), PersistenceMode(PersistenceMode.Attribute), TypeConverter(typeof(ColorConverter)), DefaultValue(typeof(Color), ""), SRDescription("DescriptionAttributeInterlacedColor")]
		public Color InterlacedColor
		{
			get
			{
				return this._interlacedColor;
			}
			set
			{
				this._interlacedColor = value;
				this.Invalidate();
			}
		}

		[PersistenceMode(PersistenceMode.Attribute), Bindable(true), SRCategory("CategoryAttributeScale"), DefaultValue(0), NotifyParentProperty(true), SRDescription("DescriptionAttributeInternalIntervalType"), RefreshProperties(RefreshProperties.All)]
		internal DateTimeIntervalType InternalIntervalType
		{
			get
			{
				return this._internalIntervalType;
			}
			set
			{
				if ((this.tempMajorGridInterval <= 0.0) || (double.IsNaN(this.tempMajorGridInterval) && (this.Interval <= 0.0)))
				{
					this.majorGrid.intervalType = value;
				}
				if ((this.tempMajorTickMarkInterval <= 0.0) || (double.IsNaN(this.tempMajorTickMarkInterval) && (this.Interval <= 0.0)))
				{
					this.majorTickMark.intervalType = value;
				}
				if ((this.tempLabelInterval <= 0.0) || (double.IsNaN(this.tempLabelInterval) && (this.Interval <= 0.0)))
				{
					this.labelStyle._IntervalType = value;
				}
				this._internalIntervalType = value;
				this.Invalidate();
			}
		}

		[DefaultValue((double)0.0), SRCategory("CategoryAttributeInterval"), Bindable(true), PersistenceMode(PersistenceMode.Attribute), SRDescription("DescriptionAttributeInterval4"), RefreshProperties(RefreshProperties.All), TypeConverter(typeof(AxisIntervalValueConverter))]
		public double Interval
		{
			get
			{
				return this.interval;
			}
			set
			{
				if (double.IsNaN(value))
				{
					this.interval = 0.0;
				}
				else
				{
					this.interval = value;
				}
				this.majorGrid.interval = this.tempMajorGridInterval;
				this.majorTickMark.interval = this.tempMajorTickMarkInterval;
				this.minorGrid.interval = this.tempMinorGridInterval;
				this.minorTickMark.interval = this.tempMinorTickMarkInterval;
				this.labelStyle._Interval = this.tempLabelInterval;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeInterval"), SRDescription("DescriptionAttributeIntervalAutoMode"), DefaultValue(0)]
		public IntervalAutoMode IntervalAutoMode
		{
			get
			{
				return this._intervalAutoMode;
			}
			set
			{
				this._intervalAutoMode = value;
				this.Invalidate();
			}
		}

		[TypeConverter(typeof(AxisIntervalValueConverter)), SRCategory("CategoryAttributeInterval"), Bindable(true), DefaultValue((double)0.0), SRDescription("DescriptionAttributeIntervalOffset6"), PersistenceMode(PersistenceMode.Attribute), RefreshProperties(RefreshProperties.All)]
		public double IntervalOffset
		{
			get
			{
				return this._intervalOffset;
			}
			set
			{
				if (double.IsNaN(value))
				{
					this._intervalOffset = 0.0;
				}
				else
				{
					this._intervalOffset = value;
				}
				this.Invalidate();
			}
		}

		[PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeInterval"), Bindable(true), DefaultValue(0), SRDescription("DescriptionAttributeIntervalOffsetType4"), RefreshProperties(RefreshProperties.All)]
		public DateTimeIntervalType IntervalOffsetType
		{
			get
			{
				return this.intervalOffsetType;
			}
			set
			{
				if (value == DateTimeIntervalType.NotSet)
				{
					this.intervalOffsetType = DateTimeIntervalType.Auto;
				}
				else
				{
					this.intervalOffsetType = value;
				}
				this.Invalidate();
			}
		}

		[DefaultValue(0), PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeInterval"), Bindable(true), SRDescription("DescriptionAttributeIntervalType4"), RefreshProperties(RefreshProperties.All)]
		public DateTimeIntervalType IntervalType
		{
			get
			{
				return this.intervalType;
			}
			set
			{
				if (value == DateTimeIntervalType.NotSet)
				{
					this.intervalType = DateTimeIntervalType.Auto;
				}
				else
				{
					this.intervalType = value;
				}
				this.majorGrid.intervalType = this.tempGridIntervalType;
				this.majorTickMark.intervalType = this.tempTickMarkIntervalType;
				this.labelStyle._IntervalType = this.tempLabelIntervalType;
				this.Invalidate();
			}
		}

		internal bool IsAxisOnAreaEdge
		{
			get
			{
				double bottom = 0.0;
				if (this.AxisPosition == AxisPosition.Bottom)
				{
					bottom = this.PlotAreaPosition.Bottom;
				}
				else if (this.AxisPosition == AxisPosition.Left)
				{
					bottom = this.PlotAreaPosition.X;
				}
				else if (this.AxisPosition == AxisPosition.Right)
				{
					bottom = this.PlotAreaPosition.Right;
				}
				else if (this.AxisPosition == AxisPosition.Top)
				{
					bottom = this.PlotAreaPosition.Y;
				}
				return (Math.Abs((double)(this.GetAxisPosition() - bottom)) < 0.0015);
			}
		}

		[SRCategory("CategoryAttributeAppearance"), NotifyParentProperty(true), Bindable(true), DefaultValue(false), SRDescription("DescriptionAttributeInterlaced"), PersistenceMode(PersistenceMode.Attribute)]
		public bool IsInterlaced
		{
			get
			{
				return this._isInterlaced;
			}
			set
			{
				this._isInterlaced = value;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeLabels"), RefreshProperties(RefreshProperties.All), Bindable(true), DefaultValue(true), SRDescription("DescriptionAttributeLabelsAutoFit"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute)]
		public bool IsLabelAutoFit
		{
			get
			{
				return this._isLabelAutoFit;
			}
			set
			{
				this._isLabelAutoFit = value;
				this.Invalidate();
			}
		}

		[Bindable(true), DefaultValue(false), NotifyParentProperty(true), SRDescription("DescriptionAttributeLogarithmic"), PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeScale")]
		public bool IsLogarithmic
		{
			get
			{
				return this._isLogarithmic;
			}
			set
			{
				this._isLogarithmic = value;
				this.Invalidate();
			}
		}

		[PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeScale"), Bindable(true), DefaultValue(true), NotifyParentProperty(true), SRDescription("DescriptionAttributeMargin")]
		public bool IsMarginVisible
		{
			get
			{
				return (this.margin > 0.0);
			}
			set
			{
				if (value)
				{
					this.margin = 100.0;
				}
				else
				{
					this.margin = 0.0;
				}
				this.Invalidate();
			}
		}

		[PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeAppearance"), Bindable(true), DefaultValue(true), SRDescription("DescriptionAttributeMarksNextToAxis"), NotifyParentProperty(true)]
		public virtual bool IsMarksNextToAxis
		{
			get
			{
				return this._isMarksNextToAxis;
			}
			set
			{
				this._isMarksNextToAxis = value;
				this.Invalidate();
			}
		}

		[NotifyParentProperty(true), SRDescription("DescriptionAttributeReverse"), PersistenceMode(PersistenceMode.Attribute), Bindable(true), DefaultValue(false), SRCategory("CategoryAttributeScale")]
		public bool IsReversed
		{
			get
			{
				return this.isReversed;
			}
			set
			{
				this.isReversed = value;
				this.Invalidate();
			}
		}

		[NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute), Bindable(true), DefaultValue(true), SRCategory("CategoryAttributeScale"), SRDescription("DescriptionAttributeStartFromZero3")]
		public bool IsStartedFromZero
		{
			get
			{
				return this.isStartedFromZero;
			}
			set
			{
				this.isStartedFromZero = value;
				this.Invalidate();
			}
		}

		private bool IsTextVertical
		{
			get
			{
				var textOrientation = this.GetTextOrientation();
				if (textOrientation != TextOrientation.Rotated90)
					return (textOrientation == TextOrientation.Rotated270);

				return true;
			}
		}

		[RefreshProperties(RefreshProperties.All), SRCategory("CategoryAttributeLabels"), Bindable(true), DefaultValue(10), SRDescription("DescriptionAttributeLabelsAutoFitMaxFontSize"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute)]
		public int LabelAutoFitMaxFontSize
		{
			get
			{
				return this.labelAutoFitMaxFontSize;
			}
			set
			{
				if (value < 5)
				{
					throw new InvalidOperationException(SR.ExceptionAxisLabelsAutoFitMaxFontSizeInvalid);
				}
				this.labelAutoFitMaxFontSize = value;
				this.Invalidate();
			}
		}

		[DefaultValue(6), SRCategory("CategoryAttributeLabels"), Bindable(true), RefreshProperties(RefreshProperties.All), SRDescription("DescriptionAttributeLabelsAutoFitMinFontSize"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute)]
		public int LabelAutoFitMinFontSize
		{
			get
			{
				return this.labelAutoFitMinFontSize;
			}
			set
			{
				if (value < 5)
				{
					throw new InvalidOperationException(SR.ExceptionAxisLabelsAutoFitMinFontSizeValueInvalid);
				}
				this.labelAutoFitMinFontSize = value;
				this.Invalidate();
			}
		}

		[DefaultValue(0x4f), SRCategory("CategoryAttributeLabels"), Bindable(true), SRDescription("DescriptionAttributeLabelsAutoFitStyle"), NotifyParentProperty(true), Editor(typeof(FlagsEnumUITypeEditor), typeof(UITypeEditor)), PersistenceMode(PersistenceMode.Attribute)]
		public LabelAutoFitStyles LabelAutoFitStyle
		{
			get
			{
				return this._labelAutoFitStyle;
			}
			set
			{
				this._labelAutoFitStyle = value;
				this.Invalidate();
			}
		}

		[Bindable(true), TypeConverter(typeof(NoNameExpandableObjectConverter)), SRCategory("CategoryAttributeLabels"), NotifyParentProperty(true), SRDescription("DescriptionAttributeLabelStyle"), PersistenceMode(PersistenceMode.InnerProperty)]
		public LabelStyle LabelStyle
		{
			get
			{
				return this.labelStyle;
			}
			set
			{
				this.labelStyle = value;
				this.labelStyle.Axis = this;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeAppearance"), PersistenceMode(PersistenceMode.Attribute), Bindable(true), DefaultValue(typeof(Color), "Black"), SRDescription("DescriptionAttributeLineColor"), NotifyParentProperty(true), TypeConverter(typeof(ColorConverter)), Editor(typeof(ChartColorEditor), typeof(UITypeEditor))]
		public Color LineColor
		{
			get
			{
				return this._lineColor;
			}
			set
			{
				this._lineColor = value;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeAppearance"), Bindable(true), DefaultValue(5), SRDescription("DescriptionAttributeLineDashStyle"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute)]
		public ChartDashStyle LineDashStyle
		{
			get
			{
				return this._lineDashStyle;
			}
			set
			{
				this._lineDashStyle = value;
				this.Invalidate();
			}
		}

		[DefaultValue(1), SRCategory("CategoryAttributeAppearance"), Bindable(true), SRDescription("DescriptionAttributeLineWidth"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute)]
		public int LineWidth
		{
			get
			{
				return this._lineWidth;
			}
			set
			{
				if (value < 0)
				{
					throw new ArgumentOutOfRangeException("value", SR.ExceptionAxisWidthIsNegative);
				}
				this._lineWidth = value;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeScale"), Bindable(true), NotifyParentProperty(true), SRDescription("DescriptionAttributeLogarithmBase"), PersistenceMode(PersistenceMode.Attribute), DefaultValue((double)10.0)]
		public double LogarithmBase
		{
			get
			{
				return this.logarithmBase;
			}
			set
			{
				if (value < 2.0)
				{
					throw new ArgumentOutOfRangeException("value", SR.ExceptionAxisScaleLogarithmBaseInvalid);
				}
				this.logarithmBase = value;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeGridTickMarks"), TypeConverter(typeof(NoNameExpandableObjectConverter)), Bindable(true), NotifyParentProperty(true), SRDescription("DescriptionAttributeMajorGrid"), PersistenceMode(PersistenceMode.InnerProperty)]
		public Grid MajorGrid
		{
			get
			{
				return this.majorGrid;
			}
			set
			{
				this.majorGrid = value;
				this.majorGrid.Axis = this;
				this.majorGrid.majorGridTick = true;
				if (!this.majorGrid.intervalChanged)
				{
					this.majorGrid.Interval = double.NaN;
				}
				if (!this.majorGrid.intervalOffsetChanged)
				{
					this.majorGrid.IntervalOffset = double.NaN;
				}
				if (!this.majorGrid.intervalTypeChanged)
				{
					this.majorGrid.IntervalType = DateTimeIntervalType.NotSet;
				}
				if (!this.majorGrid.intervalOffsetTypeChanged)
				{
					this.majorGrid.IntervalOffsetType = DateTimeIntervalType.NotSet;
				}
				this.Invalidate();
			}
		}

		[NotifyParentProperty(true), SRCategory("CategoryAttributeGridTickMarks"), Bindable(true), TypeConverter(typeof(NoNameExpandableObjectConverter)), SRDescription("DescriptionAttributeMajorTickMark"), PersistenceMode(PersistenceMode.InnerProperty)]
		public TickMark MajorTickMark
		{
			get
			{
				return this.majorTickMark;
			}
			set
			{
				this.majorTickMark = value;
				this.majorTickMark.Axis = this;
				this.majorTickMark.majorGridTick = true;
				if (!this.majorTickMark.intervalChanged)
				{
					this.majorTickMark.Interval = double.NaN;
				}
				if (!this.majorTickMark.intervalOffsetChanged)
				{
					this.majorTickMark.IntervalOffset = double.NaN;
				}
				if (!this.majorTickMark.intervalTypeChanged)
				{
					this.majorTickMark.IntervalType = DateTimeIntervalType.NotSet;
				}
				if (!this.majorTickMark.intervalOffsetTypeChanged)
				{
					this.majorTickMark.IntervalOffsetType = DateTimeIntervalType.NotSet;
				}
				this.Invalidate();
			}
		}

		[Bindable(true), DefaultValue(""), PersistenceMode(PersistenceMode.Attribute), SRDescription("DescriptionAttributeMapAreaAttributes"), SRCategory("CategoryAttributeMapArea")]
		public string MapAreaAttributes
		{
			get
			{
				return this._mapAreaAttributes;
			}
			set
			{
				this._mapAreaAttributes = value;
			}
		}

		[NotifyParentProperty(true), DefaultValue(double.NaN), SRDescription("DescriptionAttributeMaximum"), TypeConverter(typeof(AxisMinMaxAutoValueConverter)), PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeScale"), Bindable(true)]
		public double Maximum
		{
			get
			{
				if ((this._isLogarithmic && this.logarithmicConvertedToLinear) && !double.IsNaN(this.maximum))
				{
					return this.logarithmicMaximum;
				}
				return this.maximum;
			}
			set
			{
				if (double.IsNaN(value))
				{
					this._autoMaximum = true;
					this.maximum = double.NaN;
				}
				else
				{
					this.maximum = value;
					this.logarithmicMaximum = value;
					this._autoMaximum = false;
				}
				this.tempMaximum = this.maximum;
				this.tempAutoMaximum = this._autoMaximum;
				this.Invalidate();
			}
		}

		[PersistenceMode(PersistenceMode.Attribute), TypeConverter(typeof(AxisMinMaxAutoValueConverter)), SRDescription("DescriptionAttributeMinimum"), SRCategory("CategoryAttributeScale"), Bindable(true), DefaultValue(double.NaN), NotifyParentProperty(true)]
		public double Minimum
		{
			get
			{
				if ((this._isLogarithmic && this.logarithmicConvertedToLinear) && !double.IsNaN(this.maximum))
				{
					return this.logarithmicMinimum;
				}
				return this.minimum;
			}
			set
			{
				if (double.IsNaN(value))
				{
					this._autoMinimum = true;
					this.minimum = double.NaN;
				}
				else
				{
					this.minimum = value;
					this._autoMinimum = false;
					this.logarithmicMinimum = value;
				}
				this.tempMinimum = this.minimum;
				this.tempAutoMinimum = this._autoMinimum;
				this.Invalidate();
			}
		}

		[TypeConverter(typeof(NoNameExpandableObjectConverter)), SRCategory("CategoryAttributeGridTickMarks"), Bindable(true), NotifyParentProperty(true), SRDescription("DescriptionAttributeMinorGrid"), PersistenceMode(PersistenceMode.InnerProperty)]
		public Grid MinorGrid
		{
			get
			{
				return this.minorGrid;
			}
			set
			{
				this.minorGrid = value;
				this.minorGrid.Initialize(this, false);
				this.Invalidate();
			}
		}

		[TypeConverter(typeof(NoNameExpandableObjectConverter)), SRCategory("CategoryAttributeGridTickMarks"), Bindable(true), NotifyParentProperty(true), SRDescription("DescriptionAttributeMinorTickMark"), PersistenceMode(PersistenceMode.InnerProperty)]
		public TickMark MinorTickMark
		{
			get
			{
				return this.minorTickMark;
			}
			set
			{
				this.minorTickMark = value;
				this.minorTickMark.Initialize(this, false);
				this.Invalidate();
			}
		}

		[DefaultValue(""), SerializationVisibility(SerializationVisibility.Hidden), SRCategory("CategoryAttributeAppearance"), Bindable(true), Browsable(false), SRDescription("DescriptionAttributeAxis_Name"), PersistenceMode(PersistenceMode.Attribute), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public override string Name
		{
			get
			{
				return base.Name;
			}
			set
			{
				base.Name = value;
			}
		}

		[SRDescription("DescriptionAttributePostBackValue"), DefaultValue(""), SRCategory("CategoryAttributeMapArea")]
		public string PostBackValue
		{
			get
			{
				return this._postbackValue;
			}
			set
			{
				this._postbackValue = value;
			}
		}

		[SRCategory("CategoryAttributeScale"), TypeConverter(typeof(NoNameExpandableObjectConverter)), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerProperty), SRDescription("DescriptionAttributeScaleBreakStyle")]
		public virtual AxisScaleBreakStyle ScaleBreakStyle
		{
			get
			{
				return this.axisScaleBreakStyle;
			}
			set
			{
				this.axisScaleBreakStyle = value;
				this.axisScaleBreakStyle.axis = this;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Never), SRCategory("CategoryAttributeScale"), SRDescription("DescriptionAttributeAxisScaleSegmentCollection_AxisScaleSegmentCollection"), SerializationVisibility(SerializationVisibility.Hidden), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Editor(typeof(ChartCollectionEditor), typeof(UITypeEditor)), Browsable(false)]
		internal AxisScaleSegmentCollection ScaleSegments
		{
			get
			{
				return this.scaleSegments;
			}
		}

		[SRCategory("CategoryAttributeDataView"), SRDescription("DescriptionAttributeView"), PersistenceMode(PersistenceMode.InnerProperty), TypeConverter(typeof(NoNameExpandableObjectConverter)), Bindable(true)]
		public AxisScaleView ScaleView
		{
			get
			{
				return this._scaleView;
			}
			set
			{
				this._scaleView = value;
				this._scaleView.axis = this;
				this.Invalidate();
			}
		}

		internal double SetInterval
		{
			set
			{
				if ((this.tempMajorGridInterval <= 0.0) || (double.IsNaN(this.tempMajorGridInterval) && (this.Interval <= 0.0)))
				{
					this.majorGrid.interval = value;
				}
				if ((this.tempMajorTickMarkInterval <= 0.0) || (double.IsNaN(this.tempMajorTickMarkInterval) && (this.Interval <= 0.0)))
				{
					this.majorTickMark.interval = value;
				}
				if ((this.tempLabelInterval <= 0.0) || (double.IsNaN(this.tempLabelInterval) && (this.Interval <= 0.0)))
				{
					this.labelStyle._Interval = value;
				}
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeAppearance"), Editor(typeof(ChartCollectionEditor), typeof(UITypeEditor)), Bindable(true), SRDescription("DescriptionAttributeStripLines"), PersistenceMode(PersistenceMode.InnerProperty)]
		public StripLinesCollection StripLines
		{
			get
			{
				return this._stripLines;
			}
		}

		internal virtual string SubAxisName
		{
			get
			{
				return string.Empty;
			}
		}

		[SRCategory("CategoryAttributeTitle"), DefaultValue(0), PersistenceMode(PersistenceMode.Attribute), Bindable(true), SRDescription("DescriptionAttribute_TextOrientation"), NotifyParentProperty(true)]
		public TextOrientation TextOrientation
		{
			get
			{
				return this._textOrientation;
			}
			set
			{
				this._textOrientation = value;
				this.Invalidate();
			}
		}

		[SRDescription("DescriptionAttributeTitle6"), SRCategory("CategoryAttributeTitle"), Bindable(true), DefaultValue(""), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute)]
		public string Title
		{
			get
			{
				return this._title;
			}
			set
			{
				this._title = value;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeTitle"), PersistenceMode(PersistenceMode.Attribute), Bindable(true), DefaultValue(typeof(StringAlignment), "Center"), SRDescription("DescriptionAttributeTitleAlignment"), NotifyParentProperty(true)]
		public StringAlignment TitleAlignment
		{
			get
			{
				return this._titleAlignment;
			}
			set
			{
				this._titleAlignment = value;
				this.Invalidate();
			}
		}

		[SRDescription("DescriptionAttributeTitleFont"), SRCategory("CategoryAttributeTitle"), Bindable(true), DefaultValue(typeof(Font), "Microsoft Sans Serif, 8pt"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute)]
		public Font TitleFont
		{
			get
			{
				return this._titleFont;
			}
			set
			{
				this._titleFont = value;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeTitle"), PersistenceMode(PersistenceMode.Attribute), Bindable(true), DefaultValue(typeof(Color), "Black"), SRDescription("DescriptionAttributeTitleColor"), NotifyParentProperty(true), TypeConverter(typeof(ColorConverter)), Editor(typeof(ChartColorEditor), typeof(UITypeEditor))]
		public Color TitleForeColor
		{
			get
			{
				return this._titleForeColor;
			}
			set
			{
				this._titleForeColor = value;
				this.Invalidate();
			}
		}

		[Bindable(true), SRCategory("CategoryAttributeMapArea"), SRDescription("DescriptionAttributeToolTip"), DefaultValue("")]
		public string ToolTip
		{
			get
			{
				return this._toolTip;
			}
			set
			{
				this._toolTip = value;
			}
		}

		[SRCategory("CategoryAttributeMapArea"), Editor(typeof(UrlValueEditor), typeof(UITypeEditor)), Bindable(true), SRDescription("DescriptionAttributeUrl"), DefaultValue(""), PersistenceMode(PersistenceMode.Attribute)]
		public string Url
		{
			get
			{
				return this._url;
			}
			set
			{
				this._url = value;
			}
		}

		internal double ViewMaximum
		{
			get
			{
				return this._scaleView.ViewMaximum;
			}
		}

		internal double ViewMinimum
		{
			get
			{
				return this._scaleView.ViewMinimum;
			}
		}
	}
}

